summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* bpo-35081: Move interpreteridobject.h to Include/internal/ (GH-28969)Victor Stinner2021-10-1511-35/+26
| | | | Move the interpreteridobject.h header file from Include/ to Include/internal/. It only provides private functions.
* bpo-45428: Fix reading filenames from stdin in py_compile (GH-28848)Graham Inggs2021-10-152-1/+2
| | | Strip trailing '\n'.
* bpo-35134: Move classobject.h to Include/cpython/ (GH-28968)Victor Stinner2021-10-1515-45/+39
| | | | | | | | | Move classobject.h, context.h, genobject.h and longintrepr.h header files from Include/ to Include/cpython/. Remove redundant "#ifndef Py_LIMITED_API" in context.h. Remove explicit #include "longintrepr.h" in C files. It's not needed, Python.h already includes it.
* bpo-45479: Futher simplify Py_UniversalNewlineFgets. (GH-28967)Benjamin Peterson2021-10-151-23/+9
| | | Thank you to Eryk Sun for the suggestions in https://github.com/python/cpython/pull/28965#discussion_r729527143.
* closes bpo-45479: Degunkify Py_UniversalNewlineFgets. (GH-28965)Benjamin Peterson2021-10-151-32/+5
| | | Remove dead variables and control flow.
* bpo-35134: Move Include/cellobject.h to Include/cpython/ (GH-28964)Victor Stinner2021-10-157-14/+17
|
* po-35134: Move Include/funcobject.h to Include/cpython/ (GH-28958)Victor Stinner2021-10-148-10/+16
| | | Remove redundant "#ifndef Py_LIMITED_API" in funcobject.h.
* bpo-45434: Remove useless space in includes (GH-28963)Victor Stinner2021-10-1424-28/+26
| | | Micro-optimize spaces!
* bpo-41710: Fix What's New Entry credit (GH-28962)Victor Stinner2021-10-141-1/+1
| | | Fix bad copy/paste.
* bpo-45434: Limited Python.h no longer includes stdio.h (GH-28960)Victor Stinner2021-10-143-7/+16
| | | | The <Python.h> header file no longer includes <stdio.h> if the Py_LIMITED_API macro is defined.
* bpo-45474: Fix the limited C API of marshal.h (GH-28956)Victor Stinner2021-10-143-6/+27
| | | | | | | | | | Remove two functions from the limited C API: * PyMarshal_WriteLongToFile() * PyMarshal_WriteObjectToFile() The PEP 384 excludes functions expecting "FILE*" from the stable ABI. Remove also the Py_MARSHAL_VERSION macro from the limited C API.
* bpo-35134: Add Include/cpython/floatobject.h (GH-28957)Victor Stinner2021-10-1414-79/+123
| | | | | Split Include/floatobject.h into sub-files: add Include/cpython/floatobject.h and Include/internal/pycore_floatobject.h.
* bpo-21736: Set __file__ on frozen stdlib modules. (gh-28656)Eric Snow2021-10-147-94/+240
| | | | | | | | | | | | | | | | | | | | | | | | Currently frozen modules do not have __file__ set. In their spec, origin is set to "frozen" and they are marked as not having a location. (Similarly, for frozen packages __path__ is set to an empty list.) However, for frozen stdlib modules we are able to extrapolate __file__ as long as we can determine the stdlib directory at runtime. (We now do so since gh-28586.) Having __file__ set is helpful for a number of reasons. Likewise, having a non-empty __path__ means we can import submodules of a frozen package from the filesystem (e.g. we could partially freeze the encodings module). This change sets __file__ (and adds to __path__) for frozen stdlib modules. It uses sys._stdlibdir (from gh-28586) and the frozen module alias information (from gh-28655). All that work is done in FrozenImporter (in Lib/importlib/_bootstrap.py). Also, if a frozen module is imported before importlib is bootstrapped (during interpreter initialization) then we fix up that module and its spec during the importlib bootstrapping step (i.e. imporlib._bootstrap._setup()) to match what gets set by FrozenImporter, including setting the file info (if the stdlib dir is known). To facilitate this, modules imported using PyImport_ImportFrozenModule() have __origname__ set using the frozen module alias info. __origname__ is popped off during importlib bootstrap. (To be clear, even with this change the new code to set __file__ during fixups in imporlib._bootstrap._setup() doesn't actually get triggered yet. This is because sys._stdlibdir hasn't been set yet in interpreter initialization at the point importlib is bootstrapped. However, we do fix up such modules at that point to otherwise match the result of importing through FrozenImporter, just not the __file__ and __path__ parts. Doing so will require changes in the order in which things happen during interpreter initialization. That can be addressed separately. Once it is, the file-related fixup code from this PR will kick in.) Here are things this change does not do: * set __file__ for non-stdlib modules (no way of knowing the parent dir) * set __file__ if the stdlib dir is not known (nor assume the expense of finding it) * relatedly, set __file__ if the stdlib is in a zip file * verify that the filename set to __file__ actually exists (too expensive) * update __path__ for frozen packages that alias a non-package (since there is no package dir) Other things this change skips, but we may do later: * set __file__ on modules imported using PyImport_ImportFrozenModule() * set co_filename when we unmarshal the frozen code object while importing the module (e.g. in FrozenImporter.exec_module()) -- this would allow tracebacks to show source lines * implement FrozenImporter.get_filename() and FrozenImporter.get_source() https://bugs.python.org/issue21736
* bpo-45417: [Enum] fix quadratic behavior during creation (GH-28907)Carl Friedrich Bolz-Tereick2021-10-142-7/+16
| | | | | | | | | | | | Creating an Enum exhibited quadratic behavior based on the number of members in three places: - `EnumDict._member_names`: a list searched with each new member's name - member creation: a `for` loop checking each existing member to see if new member was a duplicate - `auto()` values: a list of all previous values in enum was copied before being sent to `_generate_next_value()` Two of those issues have been resolved: - `_EnumDict._member_names` is now a dictionary so lookups are fast - member creation tries a fast value lookup before falling back to the slower `for` loop lookup The third issue still remains, as `_generate_next_value_()` can be user-overridden and could corrupt the last values list if it were not copied.
* bpo-45471: Do not set PyConfig.stdlib_dir in Py_SetPythonHome(). (gh-28954)Eric Snow2021-10-142-5/+7
| | | | | The change in gh-28586 (bpo-45211) should not have included code to set _Py_path_config.stdlib_dir in Py_SetPythonHome(). We fix that here. https://bugs.python.org/issue45471
* bpo-45439: Move _PyObject_VectorcallTstate() to pycore_call.h (GH-28893)Victor Stinner2021-10-146-100/+127
| | | | | | | | | | | * Move _PyObject_VectorcallTstate() and _PyObject_FastCallTstate() to pycore_call.h (internal C API). * Convert PyObject_CallOneArg(), PyObject_Vectorcall(), _PyObject_FastCall() and PyVectorcall_Function() static inline functions to regular functions. * Add _PyVectorcall_FunctionInline() static inline function. * PyObject_Vectorcall(), _PyObject_FastCall(), and PyObject_CallOneArg() now call _PyThreadState_GET() rather than PyThreadState_Get().
* bpo-45467: Fix IncrementalDecoder and StreamReader in the ↵Serhiy Storchaka2021-10-147-35/+116
| | | | | | | | | "raw-unicode-escape" codec (GH-28944) They support now splitting escape sequences between input chunks. Add the third parameter "final" in codecs.raw_unicode_escape_decode(). It is True by default to match the former behavior.
* no-issue: Make silence about warning '_POSIX_C_SOURCE redefined' (GH-28948)Dong-hee Na2021-10-141-4/+4
|
* bpo-45367: Specialize BINARY_MULTIPLY (GH-28727)Dennis Sweeney2021-10-149-55/+162
|
* bpo-45461: Fix IncrementalDecoder and StreamReader in the "unicode-escape" ↵Serhiy Storchaka2021-10-148-32/+121
| | | | | | | | | codec (GH-28939) They support now splitting escape sequences between input chunks. Add the third parameter "final" in codecs.unicode_escape_decode(). It is True by default to match the former behavior.
* Ensure that instruction cases are self-contained (GH-28938)Brandt Bucher2021-10-131-6/+6
|
* bpo-45440: Require math.h isinf() to build (GH-28894)Victor Stinner2021-10-1310-143/+25
| | | | | | | | | | | | | | | Building Python now requires a C99 <math.h> header file providing isinf(), isnan() and isfinite() functions. Remove the Py_FORCE_DOUBLE() macro. It was used by the Py_IS_INFINITY() macro. Changes: * Remove Py_IS_NAN(), Py_IS_INFINITY() and Py_IS_FINITE() in PC/pyconfig.h. * Remove the _Py_force_double() function. * configure no longer checks if math.h defines isinf(), isnan() and isfinite().
* bpo-45434: pyport.h no longer includes <stdlib.h> (GH-28914)Victor Stinner2021-10-1329-20/+60
| | | | | Include <stdlib.h> explicitly in C files. Python.h includes <wchar.h>.
* bpo-45445: Fail if an invalid X-option is provided in the command line ↵Pablo Galindo Salgado2021-10-138-27/+88
| | | | (GH-28823)
* bpo-45386: Handle strftime's ValueError graciously in xmlrpc.client (GH-28765)rtobar2021-10-132-2/+11
| | | | | | | | | | | At import time, the xmlrpc.client module uses different date formats to test strftime so it can format years with 4 digits consistently. Depending on the underlying C library and its strftime implementation some of these calls can result in ValueErrors, blocking the xmlrpc.client module from being imported. This commit changes the behavior of this bit of code to react to ValueError exceptions, treating the format that caused them as an non-viable option.
* [docs] lexical_analysis: Expand the text on ``_`` (GH-28903)Petr Viktorin2021-10-131-4/+16
| | | | | | | | | | | | | Also: * Expand the discussion into its own entry. (Even before this, text on ``_`` was longet than the text on ``_*``.) * Briefly note the other common convention for `_`: naming unused variables. Co-authored-by: Brandt Bucher <brandtbucher@gmail.com> Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-24444: fix an error in argparse help when help for an option is blank ↵andrei kulakov2021-10-133-5/+44
| | | | (GH-28050)
* bpo-45239: Fix parsedate_tz when time has more than 2 dots in it (GH-28452)Ben Hoyt2021-10-133-0/+6
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-45229: Make tkinter tests discoverable (GH-28637)Serhiy Storchaka2021-10-1318-606/+498
|
* bpo-45410: regrtest replaces print_warning.orig_stderr (GH-28926)Victor Stinner2021-10-133-3/+53
| | | | | | When running Python tests with -W, runtest() now replaces support.print_warning.orig_stderr to preserve the messages order. Add an unit test.
* bpo-45434: Mark the PyTokenizer C API as private (GH-28924)Victor Stinner2021-10-137-48/+40
| | | | | | | | | | | | | | Rename PyTokenize functions to mark them as private: * PyTokenizer_FindEncodingFilename() => _PyTokenizer_FindEncodingFilename() * PyTokenizer_FromString() => _PyTokenizer_FromString() * PyTokenizer_FromFile() => _PyTokenizer_FromFile() * PyTokenizer_FromUTF8() => _PyTokenizer_FromUTF8() * PyTokenizer_Free() => _PyTokenizer_Free() * PyTokenizer_Get() => _PyTokenizer_Get() Remove the unused PyTokenizer_FindEncoding() function. import.c: remove unused #include "errcode.h".
* bpo-45256: Fix cleanup of stolen locals for Python-to-Python calls (GH-28905)Pablo Galindo Salgado2021-10-131-10/+24
|
* bpo-45434: Remove pystrhex.h header file (GH-28923)Victor Stinner2021-10-1322-63/+93
| | | | | | | | | | | | | | | Move Include/pystrhex.h to Include/internal/pycore_strhex.h. The header file only contains private functions. The following C extensions are now built with Py_BUILD_CORE_MODULE macro defined to get access to the internal C API: * _blake2 * _hashopenssl * _md5 * _sha1 * _sha3 * _ssl * binascii
* bpo-45340: Don't create object dictionaries unless actually needed (GH-28802)Mark Shannon2021-10-1318-400/+721
| | | | | | | | | | | | | | * Never change types' cached keys. It could invalidate inline attribute objects. * Lazily create object dictionaries. * Update specialization of LOAD/STORE_ATTR. * Don't update shared keys version for deletion of value. * Update gdb support to handle instance values. * Rename SPLIT_KEYS opcodes to INSTANCE_VALUE.
* bpo-45434: Move _Py_BEGIN_SUPPRESS_IPH to pycore_fileutils.h (GH-28922)Victor Stinner2021-10-1310-42/+44
|
* pycore_pystate.h no longer redefines PyThreadState_GET() (GH-28921)Victor Stinner2021-10-1323-77/+87
| | | | | | | | | | | | | | | | | | | | | | Redefining the PyThreadState_GET() macro in pycore_pystate.h is useless since it doesn't affect files not including it. Either use _PyThreadState_GET() directly, or don't use pycore_pystate.h internal C API. For example, the _testcapi extension don't use the internal C API, but use the public PyThreadState_Get() function instead. Replace PyThreadState_Get() with _PyThreadState_GET(). The _PyThreadState_GET() macro is more efficient than PyThreadState_Get() and PyThreadState_GET() function calls which call fail with a fatal Python error. posixmodule.c and _ctypes extension now include <windows.h> before pycore header files (like pycore_call.h). _PyTraceback_Add() now uses _PyErr_Fetch()/_PyErr_Restore() instead of PyErr_Fetch()/PyErr_Restore(). The _decimal and _xxsubinterpreters extensions are now built with the Py_BUILD_CORE_MODULE macro defined to get access to the internal C API.
* bpo-45410: regrtest -W leaves stdout/err FD unchanged (GH-28915)Victor Stinner2021-10-137-82/+19
| | | | | | | | | | | | support.print_warning() now stores the original value of sys.__stderr__ and uses it to log warnings. libregrtest uses the same stream to log unraisable exceptions and uncaught threading exceptions. Partially revert commit dbe213de7ef28712bbfdb9d94a33abb9c33ef0c2: libregrtest no longer replaces sys.__stdout__, sys.__stderr__, and stdout and stderr file descriptors. Remove also a few unused imports in libregrtest.
* bpo-20692: Add Programming FAQ entry for 1.__class__ error. (GH-28918)Terry Jan Reedy2021-10-132-0/+23
| | | To avoid error, add either space or parentheses.
* bpo-45453: Fix test_embed.StdPrinterTests (GH-28916)Victor Stinner2021-10-131-8/+4
| | | | | | | test_embed.StdPrinterTests now always use the file descriptor 1 for stdout, rather than using sys.__stdout__.fileno(). PyFile_NewStdPrinter() does crash if the argument is not 1 or 2. Fix also a few pyflakes warnings: remove unused import and variables.
* bpo-45434: bytearrayobject.h no longer includes <stdarg.h> (GH-28913)Victor Stinner2021-10-135-6/+3
| | | | bytearrayobject.h and _lzmamodule.c don't use va_list and so don't need to include <stdarg.h>.
* bpo-45434: Convert Py_GETENV() macro to a function (GH-28912)Victor Stinner2021-10-132-1/+9
| | | Avoid calling directly getenv() in the header file.
* bpo-45405: Prevent ``internal configure error`` when running ``configure`` ↵David Bohman2021-10-133-6/+12
| | | | | | | | with recent versions of non-Apple clang. (#28845) Change the configure logic to function properly on macOS when the compiler outputs a platform triplet for option --print-multiarch. Co-authored-by: Ned Deily <nad@python.org>
* bpo-45410: Enhance libregrtest -W/--verbose3 option (GH-28908)Victor Stinner2021-10-123-15/+72
| | | | | | | | | | | libregrtest -W/--verbose3 now also replace sys.__stdout__, sys.__stderr__, and stdout and stderr file descriptors (fd 1 and fd 2). support.print_warning() messages are now logged in the expected order. The "./python -m test test_eintr -W" command no longer logs into stdout if the test pass.
* Fix spelling in Misc (GH-28858)1809092021-10-121-1/+1
|
* bpo-45421: Remove dead code from html.parser (GH-28847)Alberto Mardegan2021-10-121-7/+0
| | | | | Support for HtmlParserError was removed back in 2014 with commit 73a4359eb0eb624c588c5d52083ea4944f9787ea, however this small block was missed.
* bpo-44991: Normalise function and collation callback naming (GH-28209)Erlend Egeberg Aasland2021-10-121-7/+5
|
* bpo-45441: Update some moved URLs in documentation (GH-28861)1809092021-10-124-6/+6
|
* Slight correct grammar (GH-28860)nobodyatandnothing2021-10-121-1/+1
|
* Fix format string in _PyImport_LoadDynamicModuleWithSpec() (GH-28863)Serhiy Storchaka2021-10-121-1/+1
|
* bpo-45439: Move _PyObject_CallNoArgs() to pycore_call.h (GH-28895)Victor Stinner2021-10-1238-64/+89
| | | | | | | * Move _PyObject_CallNoArgs() to pycore_call.h (internal C API). * _ssl, _sqlite and _testcapi extensions now call the public PyObject_CallNoArgs() function, rather than _PyObject_CallNoArgs(). * _lsprof extension is now built with Py_BUILD_CORE_MODULE macro defined to get access to internal _PyObject_CallNoArgs().