Commit Graph

115127 Commits

Author SHA1 Message Date
Nikita Sobolev b5f711185b
gh-94808: add tests covering `PyEval_GetFuncDesc` function (GH-98300) 2022-11-05 13:07:59 +00:00
Sam James 12078e78f6
gh-99086: Fix implicit int compiler warning in configure check for PTHREAD_SCOPE_SYSTEM (#99085) 2022-11-05 09:30:31 +01:00
Guido van Rossum d04899abb0
GH-99104: Update headers for bytecodes.c and generate_cases.py (#99112)
Also tweak the labels near the end of bytecodes.c.
2022-11-04 17:40:43 -07:00
Brandt Bucher 6a8d3c57af
GH-98686: Fix compiler warning for HAS_ARG (GH-99106) 2022-11-04 16:54:32 -07:00
Mark Shannon 7a020b8e5b
GH-98831: Add some macros definitions to bytecodes.c to reduce IDE warnings. (#99093) 2022-11-04 16:37:53 -07:00
Guido van Rossum c885623e9f
GH-98831: Auto-generate PREDICTED() macro calls (#99102)
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2022-11-04 15:30:17 -07:00
Brandt Bucher e99380cc39
GH-98831: Add `regen-cases` to `regen-all` (#99107) 2022-11-04 15:00:51 -07:00
Victor Stinner f09da28768
gh-90867: test.support.wait_process() uses LONG_TIMEOUT (#99071)
The test.support.wait_process() function now uses a timeout of
LONG_TIMEOUT seconds by default, instead of SHORT_TIMEOUT.  It
doesn't matter if a Python buildbot is slower, it only matters that
the process completes. The timeout should just be shorter than
"forever".
2022-11-04 14:41:33 +01:00
Victor Stinner 387f72588d
gh-90716: Fix pylong_int_from_string() refleak (#99094)
Fix validated by:

    $ ./python -m test -R 3:3 test_int
    Tests result: SUCCESS
2022-11-04 14:24:10 +01:00
Skip Montanaro c0bf7607a1
minor edits to locale doc (#98537) 2022-11-04 06:02:11 -07:00
Michael Droettboom 2844aa6a8e
Support comparing two sets of pystats (GH-98816)
This adds support for comparing pystats collected from two different builds.

- The `--json-output` can be used to load in a set of raw stats and output a
  JSON file.
- Two of these JSON files can be provided on the next run, and then comparative
  results between the two are output.
2022-11-04 10:15:54 +00:00
Nikita Sobolev 044bcc1771
gh-94808: Cover `LOAD_GLOBAL` for custom dict subtypes (GH-96767) 2022-11-04 09:58:38 +00:00
Nick Pope 016c7d37b6
Docs: add `named` to the list of styles in the sqlite3.paramstyle attr docs (#99078) 2022-11-04 00:21:01 +01:00
Gregory P. Smith 4c4b5ce2e5
gh-90716: bugfixes and more tests for _pylong. (#99073)
* Properly decref on _pylong import error.
* Improve the error message on _pylong TypeError.
* Fix the assertion error in pydebug builds to be a TypeError.
* Tie the return value comments together.

These are minor followups to issues not caught among the reviewers on
https://github.com/python/cpython/pull/96673.
2022-11-03 16:18:38 -07:00
Gregory P. Smith bee1070289
gh-73691: Increase size limits in _xxtestfuzz (#99070)
Now that our int<->str conversions are size limited and we have the
_pylong module handling larger integers, we don't need to limit
everything just to avoid wasting time in the quadratic time DoS-like
case while fuzzing.

We can tweak these further after seeing how this goes.
2022-11-03 14:41:20 -07:00
Kumar Aditya 0ee59a9ca3
GH-90699: Remove `_Py_IDENTIFIER` usage from `_ctypes` (GH-99054) 2022-11-03 13:20:10 -07:00
Victor Stinner 0faa0ba240
gh-92584: Remove the distutils package (#99061)
Remove the distutils package. It was deprecated in Python 3.10 by PEP
632 "Deprecate distutils module". For projects still using distutils
and cannot be updated to something else, the setuptools project can
be installed: it still provides distutils.

* Remove Lib/distutils/ directory
* Remove test_distutils
* Remove references to distutils
* Skip test_check_c_globals and test_peg_generator since they use
  distutils
2022-11-03 19:27:27 +01:00
Victor Stinner b07f546ea3
gh-98978: Fix Py_SetPythonHome(NULL) (#99066)
Fix use-after-free in Py_SetPythonHome(NULL), Py_SetProgramName(NULL)
and _Py_SetProgramFullPath(NULL) function calls.

Issue reported by Benedikt Reinartz.
2022-11-03 18:34:32 +01:00
Victor Stinner ef0e72b31d
gh-94172: Remove keyfile, certfile and check_hostname parameters (#94173)
Remove the keyfile, certfile and check_hostname parameters,
deprecated since Python 3.6, in modules: ftplib, http.client,
imaplib, poplib and smtplib. Use the context parameter (ssl_context
in imaplib) instead.

Parameters following the removed parameters become keyword-only
parameters.

ftplib: Remove the FTP_TLS.ssl_version class attribute: use the
context parameter instead.
2022-11-03 18:32:25 +01:00
Victor Stinner 9c4ae037b9
gh-90716: Remove _pylong._DEBUG flag (#99063)
To debug the _pylong module, it's trivial to add this code again
locally. There is not need to keep it in Python releases.
2022-11-03 18:16:28 +01:00
Nikita Sobolev e3b9832e57
gh-98884: [pathlib] remove `hasattr` check for `lru_cache` (#98885) 2022-11-03 17:14:12 +00:00
Victor Stinner e99c507013
gh-92584: Remove references to removed _bootsubprocess (#99062)
The _bootsubprocess module was removed in gh-93939
by commit 81dca70d70.
2022-11-03 18:12:45 +01:00
Johnny11502 00b6745f16
gh-97909: PyMemberDef & PyGetSetDef members are not marked up (GH-98810) 2022-11-03 17:57:30 +01:00
Victor Stinner a60ddd31be
gh-98401: Invalid escape sequences emits SyntaxWarning (#99011)
A backslash-character pair that is not a valid escape sequence now
generates a SyntaxWarning, instead of DeprecationWarning.  For
example, re.compile("\d+\.\d+") now emits a SyntaxWarning ("\d" is an
invalid escape sequence), use raw strings for regular expression:
re.compile(r"\d+\.\d+"). In a future Python version, SyntaxError will
eventually be raised, instead of SyntaxWarning.

Octal escapes with value larger than 0o377 (ex: "\477"), deprecated
in Python 3.11, now produce a SyntaxWarning, instead of
DeprecationWarning. In a future Python version they will be
eventually a SyntaxError.

codecs.escape_decode() and codecs.unicode_escape_decode() are left
unchanged: they still emit DeprecationWarning.

* The parser only emits SyntaxWarning for Python 3.12 (feature
  version), and still emits DeprecationWarning on older Python
  versions.
* Fix SyntaxWarning by using raw strings in Tools/c-analyzer/ and
  wasm_build.py.
2022-11-03 17:53:25 +01:00
Guido van Rossum 916af11a97
GH-98831: Remove redundant extract_cases.py script (GH-99065)
Debt I owe from PR GH-98830.
2022-11-03 09:50:35 -07:00
Victor Stinner b8a9f13abb
gh-97616: test_list_resize_overflow() uses sys.maxsize (#99057) 2022-11-03 15:56:12 +01:00
Shantanu 1208037246
gh-83004: Clean up refleak in _io initialisation (#98840) 2022-11-03 07:29:11 -07:00
serge-sans-paille 8c4de57de9
gh-98948: Remove obsolete readelf dependency (#98949)
This got introduced in commit 5884449539
to determine if readline is already linked against curses or tinfo in
the setup.py, which is no longer present.
2022-11-03 14:31:37 +01:00
Victor Stinner cff1c20667
gh-94199: Remove ssl.wrap_socket() documentation (#99023)
The function has been removed. In the ssl documentation, replace
references to the ssl.wrap_socket() function with references to the
ssl.SSLContext.wrap_socket() method.

Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
2022-11-03 13:33:33 +01:00
Mark Shannon f4adb97506
GH-96793: Implement PEP 479 in bytecode. (GH-99006)
* Handle converting StopIteration to RuntimeError in bytecode.

* Add custom instruction for converting StopIteration into RuntimeError.
2022-11-03 11:38:51 +00:00
Serhiy Storchaka e9ac890c02
gh-98740: Fix validation of conditional expressions in RE (GH-98764)
In very rare circumstances the JUMP opcode could be confused with the
argument of the opcode in the "then" part which doesn't end with the
JUMP opcode. This led to incorrect detection of the final JUMP opcode
and incorrect calculation of the size of the subexpression.

NOTE: Changed return value of functions _validate_inner() and
_validate_charset() in Modules/_sre/sre.c.  Now they return 0 on success,
-1 on failure, and 1 if the last op is JUMP (which usually is a failure).
Previously they returned 1 on success and 0 on failure.
2022-11-03 09:23:46 +02:00
Guido van Rossum 41bc101dd6
GH-98831: "Generate" the interpreter (#98830)
The switch cases (really TARGET(opcode) macros) have been moved from ceval.c to generated_cases.c.h. That file is generated from instruction definitions in bytecodes.c (which impersonates a C file so the C code it contains can be edited without custom support in e.g. VS Code).

The code generator lives in Tools/cases_generator (it has a README.md explaining how it works). The DSL used to describe the instructions is a work in progress, described in https://github.com/faster-cpython/ideas/blob/main/3.12/interpreter_definition.md.

This is surely a work-in-progress. An easy next step could be auto-generating super-instructions.

**IMPORTANT: Merge Conflicts**

If you get a merge conflict for instruction implementations in ceval.c, your best bet is to port your changes to bytecodes.c. That file looks almost the same as the original cases, except instead of `TARGET(NAME)` it uses `inst(NAME)`, and the trailing `DISPATCH()` call is omitted (the code generator adds it automatically).
2022-11-02 21:31:26 -07:00
Nikita Sobolev 2cfcaf5af6
gh-98999: Raise `ValueError` in `_pyio` on closed buffers (gh-99009) 2022-11-03 12:03:12 +09:00
Hugo van Kemenade 26720fffd0
Docs: Add 'as, match statement' to the index (#99001) 2022-11-02 19:15:00 -07:00
Nikita Sobolev 29e027c3e6
gh-98512: Add more tests for `ValuesView` (#98515) 2022-11-02 19:10:42 -07:00
Skip Montanaro 1fd20d0b57
argparse howto: Use f-string in preference to "...".format() (#98883) 2022-11-02 19:08:08 -07:00
Pablo Galindo Salgado c053284e39
gh-96997: Clarify the contract of PyMem_SetAllocator() (#98977) 2022-11-02 21:49:12 +00:00
Kumar Aditya 908e81f6c8
GH-90699: Remove `_Py_IDENTIFIER` usage from `_elementtree` module (GH-99012) 2022-11-02 13:29:41 -07:00
Victor Stinner f3007ac370
gh-98393: Update test_os for bytes-like types (#98487)
Address Serhiy Storchaka's review.
2022-11-02 20:45:58 +01:00
Brett Cannon 22bab74c8f
gh-97731: Specify the full path to the docs for `make docclean` (GH-98982)
Specify the full path to the docs for `make docclean`
This is to have `make clean` not error out on cross-builds.
2022-11-02 12:34:22 -07:00
Chaim Sanders e3ec272f57
gh-98415: Fix uuid.getnode() ifconfig implementation (#98423)
The uuid.getnode() function has multiple implementations, tested sequentially.
The ifconfig implementation was incorrect and always failed: fix it.

In practice, functions of libuuid library are preferred, if available:
uuid_generate_time_safe(), uuid_create() or uuid_generate_time().

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2022-11-02 19:41:20 +01:00
Steve Dower 3d889dc0a0
gh-98790: When DLLs directory is missing on Windows, assume executable_dir contains PYD files instead (GH-98936) 2022-11-02 18:38:40 +00:00
Serhiy Storchaka f520d720f6
gh-99016: Make build scripts compatible with Python 3.8 (GH-99017) 2022-11-02 20:30:09 +02:00
Brandt Bucher 276d77724f
GH-98686: Quicken everything (GH-98687) 2022-11-02 10:42:57 -07:00
Kumar Aditya 18fc232e07
GH-90699: Remove `_Py_IDENTIFIER` usage from `_asyncio` module (#99010) 2022-11-02 10:16:06 -07:00
Jelle Zijlstra f7241aaf6f
gh-98989: configure: add 3.11 to list of Pythons (#98988)
Closes #98989

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2022-11-02 10:05:42 -07:00
Kumar Aditya 780757ac58
GH-90699: Remove `_Py_IDENTIFIER` usage from `_json` module (GH-98956) 2022-11-02 09:03:38 -07:00
Irit Katriel df84b7b0bc
gh-87092: remove unused SET_LOC/UNSET_LOC macros (GH-98914) 2022-11-02 15:52:11 +00:00
Kumar Aditya 0a806f2684
GH-90699: Remove `_Py_IDENTIFIER` usage from `_curses` module (GH-98957) 2022-11-02 08:41:11 -07:00
Irit Katriel 6d683d8525
gh-87092: do not allocate PyFutureFeatures dynamically (GH-98913) 2022-11-02 15:13:07 +00:00