• Victor Stinner's avatar
    Issue #29300: Convert _struct module to Argument Clinic · 3f2d1013
    Victor Stinner yazdı
    * The struct module now requires contiguous buffers.
    * Convert most functions and methods of the _struct module to Argument Clinic
    * Use "Py_buffer" type for the "buffer" argument. Argument Clinic is
      responsible to create and release the Py_buffer object.
    * Use "PyStructObject *" type for self to avoid explicit conversions.
    * Add an unit test on the _struct.Struct.unpack_from() method to test passing
      arguments as keywords.
    * Rephrase docstrings.
    * Rename "fmt" argument to "format" in docstrings and the documentation.
    
    As a side effect, functions and methods which used METH_VARARGS calling
    convention like struct.pack() now use the METH_FASTCALL calling convention
    which avoids the creation of temporary tuple to pass positional arguments and
    so is faster. For example, struct.pack("i", 1) becomes 1.56x faster (-36%)::
    
        $ ./python -m perf timeit \
            -s 'import struct; pack=struct.pack' 'pack("i", 1)' \
            --compare-to=../default-ref/python
        Median +- std dev: 119 ns +- 1 ns -> 76.8 ns +- 0.4 ns: 1.56x faster (-36%)
        Significant (t=295.91)
    
    Patch co-written with Serhiy Storchaka.
    3f2d1013
Adı
Son kayıt (commit)
Son güncelleme
..
asyncio Loading commit data...
collections Loading commit data...
concurrent Loading commit data...
ctypes Loading commit data...
curses Loading commit data...
dbm Loading commit data...
distutils Loading commit data...
email Loading commit data...
encodings Loading commit data...
ensurepip Loading commit data...
html Loading commit data...
http Loading commit data...
idlelib Loading commit data...
importlib Loading commit data...
json Loading commit data...
lib2to3 Loading commit data...
logging Loading commit data...
msilib Loading commit data...
multiprocessing Loading commit data...
pydoc_data Loading commit data...
site-packages Loading commit data...
sqlite3 Loading commit data...
test Loading commit data...
tkinter Loading commit data...
turtledemo Loading commit data...
unittest Loading commit data...
urllib Loading commit data...
venv Loading commit data...
wsgiref Loading commit data...
xml Loading commit data...
xmlrpc Loading commit data...
__future__.py Loading commit data...
__phello__.foo.py Loading commit data...
_bootlocale.py Loading commit data...
_collections_abc.py Loading commit data...
_compat_pickle.py Loading commit data...
_compression.py Loading commit data...
_dummy_thread.py Loading commit data...
_markupbase.py Loading commit data...
_osx_support.py Loading commit data...
_pydecimal.py Loading commit data...
_pyio.py Loading commit data...
_sitebuiltins.py Loading commit data...
_strptime.py Loading commit data...
_threading_local.py Loading commit data...
_weakrefset.py Loading commit data...
abc.py Loading commit data...
aifc.py Loading commit data...
antigravity.py Loading commit data...
argparse.py Loading commit data...
ast.py Loading commit data...
asynchat.py Loading commit data...
asyncore.py Loading commit data...
base64.py Loading commit data...
bdb.py Loading commit data...
binhex.py Loading commit data...
bisect.py Loading commit data...
bz2.py Loading commit data...
cProfile.py Loading commit data...
calendar.py Loading commit data...
cgi.py Loading commit data...
cgitb.py Loading commit data...
chunk.py Loading commit data...
cmd.py Loading commit data...
code.py Loading commit data...
codecs.py Loading commit data...
codeop.py Loading commit data...
colorsys.py Loading commit data...
compileall.py Loading commit data...
configparser.py Loading commit data...
contextlib.py Loading commit data...
copy.py Loading commit data...
copyreg.py Loading commit data...
crypt.py Loading commit data...
csv.py Loading commit data...
datetime.py Loading commit data...
decimal.py Loading commit data...
difflib.py Loading commit data...
dis.py Loading commit data...
doctest.py Loading commit data...
dummy_threading.py Loading commit data...
enum.py Loading commit data...
filecmp.py Loading commit data...
fileinput.py Loading commit data...
fnmatch.py Loading commit data...
formatter.py Loading commit data...
fractions.py Loading commit data...
ftplib.py Loading commit data...
functools.py Loading commit data...
genericpath.py Loading commit data...
getopt.py Loading commit data...
getpass.py Loading commit data...
gettext.py Loading commit data...
glob.py Loading commit data...
gzip.py Loading commit data...
hashlib.py Loading commit data...
heapq.py Loading commit data...
hmac.py Loading commit data...
imaplib.py Loading commit data...
imghdr.py Loading commit data...
imp.py Loading commit data...
inspect.py Loading commit data...
io.py Loading commit data...
ipaddress.py Loading commit data...
keyword.py Loading commit data...
linecache.py Loading commit data...
locale.py Loading commit data...
lzma.py Loading commit data...
macpath.py Loading commit data...
mailbox.py Loading commit data...
mailcap.py Loading commit data...
mimetypes.py Loading commit data...
modulefinder.py Loading commit data...
netrc.py Loading commit data...
nntplib.py Loading commit data...
ntpath.py Loading commit data...
nturl2path.py Loading commit data...
numbers.py Loading commit data...
opcode.py Loading commit data...
operator.py Loading commit data...
optparse.py Loading commit data...
os.py Loading commit data...
pathlib.py Loading commit data...
pdb.py Loading commit data...
pickle.py Loading commit data...
pickletools.py Loading commit data...
pipes.py Loading commit data...
pkgutil.py Loading commit data...
platform.py Loading commit data...
plistlib.py Loading commit data...
poplib.py Loading commit data...
posixpath.py Loading commit data...
pprint.py Loading commit data...
profile.py Loading commit data...
pstats.py Loading commit data...
pty.py Loading commit data...
py_compile.py Loading commit data...
pyclbr.py Loading commit data...
pydoc.py Loading commit data...
queue.py Loading commit data...
quopri.py Loading commit data...
random.py Loading commit data...
re.py Loading commit data...
reprlib.py Loading commit data...
rlcompleter.py Loading commit data...
runpy.py Loading commit data...
sched.py Loading commit data...
secrets.py Loading commit data...
selectors.py Loading commit data...
shelve.py Loading commit data...
shlex.py Loading commit data...
shutil.py Loading commit data...
signal.py Loading commit data...
site.py Loading commit data...
smtpd.py Loading commit data...
smtplib.py Loading commit data...
sndhdr.py Loading commit data...
socket.py Loading commit data...
socketserver.py Loading commit data...
sre_compile.py Loading commit data...
sre_constants.py Loading commit data...
sre_parse.py Loading commit data...
ssl.py Loading commit data...
stat.py Loading commit data...
statistics.py Loading commit data...
string.py Loading commit data...
stringprep.py Loading commit data...
struct.py Loading commit data...
subprocess.py Loading commit data...
sunau.py Loading commit data...
symbol.py Loading commit data...
symtable.py Loading commit data...
sysconfig.py Loading commit data...
tabnanny.py Loading commit data...
tarfile.py Loading commit data...
telnetlib.py Loading commit data...
tempfile.py Loading commit data...
textwrap.py Loading commit data...
this.py Loading commit data...
threading.py Loading commit data...
timeit.py Loading commit data...
token.py Loading commit data...
tokenize.py Loading commit data...
trace.py Loading commit data...
traceback.py Loading commit data...
tracemalloc.py Loading commit data...
tty.py Loading commit data...
turtle.py Loading commit data...
types.py Loading commit data...
typing.py Loading commit data...
uu.py Loading commit data...
uuid.py Loading commit data...
warnings.py Loading commit data...
wave.py Loading commit data...
weakref.py Loading commit data...
webbrowser.py Loading commit data...
xdrlib.py Loading commit data...
zipapp.py Loading commit data...
zipfile.py Loading commit data...