]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agogh-99127: Allow some features of syslog to the main interpreter only (gh-99128)
Dong-hee Na [Tue, 29 Nov 2022 22:58:20 +0000 (07:58 +0900)] 
gh-99127: Allow some features of syslog to the main interpreter only (gh-99128)

2 years agogh-82836: fix private network check (#97733)
Pete Wicken [Tue, 29 Nov 2022 21:32:18 +0000 (21:32 +0000)] 
gh-82836: fix private network check (#97733)

Fixes private checks for network objects. The previous method would incorrectly return True for a private check in cases such as "0.0.0.0/0".

2 years agoDocs: improve accuracy of socketserver reference (#24767)
Géry Ogam [Tue, 29 Nov 2022 20:34:52 +0000 (21:34 +0100)] 
Docs: improve accuracy of socketserver reference (#24767)

2 years agowhatsnew-3.10: Mention PEP 647 in the Release highlights section. (#99853)
Yilei "Dolee" Yang [Tue, 29 Nov 2022 20:30:58 +0000 (12:30 -0800)] 
whatsnew-3.10: Mention PEP 647 in the Release highlights section. (#99853)

Mention PEP 647 in the Release highlights section.

Also re-ordered the list so it matches the order in the details sections below.

2 years agogh-90717: Update the documentation for the altchars paremeter in base64 library ...
Sam Ezeh [Tue, 29 Nov 2022 16:21:01 +0000 (16:21 +0000)] 
gh-90717: Update the documentation for the altchars paremeter in base64 library (GH-94187)

2 years agogh-99845: Clean up _PyObject_VAR_SIZE() usage (#99847)
Victor Stinner [Tue, 29 Nov 2022 11:15:21 +0000 (12:15 +0100)] 
gh-99845: Clean up _PyObject_VAR_SIZE() usage (#99847)

* code_sizeof() now uses an unsigned type (size_t) to compute the result.
* Fix _PyObject_ComputedDictPointer(): cast _PyObject_VAR_SIZE() to
  Py_ssize_t, rather than long: it's a different type on 64-bit Windows.
* Clarify that _PyObject_VAR_SIZE() uses an unsigned type (size_t).

2 years agogh-99845: Change _PyDict_KeysSize() return type to size_t (#99848)
Victor Stinner [Tue, 29 Nov 2022 11:12:17 +0000 (12:12 +0100)] 
gh-99845: Change _PyDict_KeysSize() return type to size_t (#99848)

* Change _PyDict_KeysSize() and shared_keys_usable_size() return type
  from signed (Py_ssize_t) to unsigned (size_t) type.
* new_values() argument type is now unsigned (size_t).
* init_inline_values() now uses size_t rather than int for the 'i'
  iterator variable.
* type.__sizeof__() implementation now uses unsigned (size_t) type.

2 years agoGH-91375: Port `_asyncio` static types to heap types and module state (#99122)
Kumar Aditya [Tue, 29 Nov 2022 10:07:37 +0000 (15:37 +0530)] 
GH-91375: Port `_asyncio` static types to heap types and module state (#99122)

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agogh-99593: Add tests for Unicode C API (part 1) (GH-99651)
Serhiy Storchaka [Tue, 29 Nov 2022 07:59:56 +0000 (09:59 +0200)] 
gh-99593: Add tests for Unicode C API (part 1) (GH-99651)

Add tests for functions corresponding to the str class methods.

2 years agogh-99344, gh-99379, gh-99382: Fix issues in substitution of ParamSpec and TypeVarTupl...
Serhiy Storchaka [Tue, 29 Nov 2022 07:46:52 +0000 (09:46 +0200)] 
gh-99344, gh-99379, gh-99382: Fix issues in substitution of ParamSpec and TypeVarTuple (GH-99412)

* Fix substitution of TypeVarTuple and ParamSpec together in user generics.

* Fix substitution of ParamSpec followed by TypeVarTuple in generic aliases.

* Check the number of arguments in substitution in user generics containing a
  TypeVarTuple and one or more TypeVar.

2 years agogh-99811: Use correct variable to search for time in format string (GH-99812)
cemysce [Mon, 28 Nov 2022 18:25:03 +0000 (13:25 -0500)] 
gh-99811: Use correct variable to search for time in format string (GH-99812)

Use correct variable to search for asctime

2 years ago`fnmatch` docs: link to `fnmatch.filter()`, not `builtins.filter()` (#99819)
Matthew Hughes [Mon, 28 Nov 2022 18:08:08 +0000 (18:08 +0000)] 
`fnmatch` docs: link to `fnmatch.filter()`, not `builtins.filter()` (#99819)

2 years agoUse _Py_RVALUE() in macros (#99844)
Victor Stinner [Mon, 28 Nov 2022 16:42:22 +0000 (17:42 +0100)] 
Use _Py_RVALUE() in macros (#99844)

The following macros are modified to use _Py_RVALUE(), so they can no
longer be used as l-value:

* DK_LOG_SIZE()
* _PyCode_CODE()
* _PyList_ITEMS()
* _PyTuple_ITEMS()
* _Py_SLIST_HEAD()
* _Py_SLIST_ITEM_NEXT()

_PyCode_CODE() is private and other macros are part of the internal
C API.

2 years agoGrammatical improvements for ctypes 'winmode' documentation (GH-19167)
David Miguel Susano Pinto [Mon, 28 Nov 2022 16:05:21 +0000 (16:05 +0000)] 
Grammatical improvements for ctypes 'winmode' documentation (GH-19167)

2 years agogh-89653: PEP 670: Convert macros to functions (#99843)
Victor Stinner [Mon, 28 Nov 2022 15:40:08 +0000 (16:40 +0100)] 
gh-89653: PEP 670: Convert macros to functions (#99843)

Convert macros to static inline functions to avoid macro pitfalls,
like duplication of side effects:

* DK_ENTRIES()
* DK_UNICODE_ENTRIES()
* PyCode_GetNumFree()
* PyFloat_AS_DOUBLE()
* PyInstanceMethod_GET_FUNCTION()
* PyMemoryView_GET_BASE()
* PyMemoryView_GET_BUFFER()
* PyMethod_GET_FUNCTION()
* PyMethod_GET_SELF()
* PySet_GET_SIZE()
* _PyHeapType_GET_MEMBERS()

Changes:

* PyCode_GetNumFree() casts PyCode_GetNumFree.co_nfreevars from int
  to Py_ssize_t to be future proof, and because Py_ssize_t is
  commonly used in the C API.
* PyCode_GetNumFree() doesn't cast its argument: the replaced macro
  already required the exact type PyCodeObject*.
* Add assertions in some functions using "CAST" macros to check
  the arguments type when Python is built with assertions
  (debug build).
* Remove an outdated comment in unicodeobject.h.

2 years agobpo-31718: Fix io.IncrementalNewlineDecoder SystemErrors and segfaults (#18640)
Zackery Spytz [Mon, 28 Nov 2022 10:46:40 +0000 (02:46 -0800)] 
bpo-31718: Fix io.IncrementalNewlineDecoder SystemErrors and segfaults (#18640)

Co-authored-by: Oren Milman <orenmn@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2 years agobpo-41825: restructure docs for the os.wait*() family (GH-22356)
Georg Brandl [Mon, 28 Nov 2022 09:41:24 +0000 (10:41 +0100)] 
bpo-41825: restructure docs for the os.wait*() family (GH-22356)

2 years agogh-99249: Clarify "read-only" slots tp_bases & tp_mro (GH-99342)
Petr Viktorin [Mon, 28 Nov 2022 08:22:08 +0000 (09:22 +0100)] 
gh-99249: Clarify "read-only" slots tp_bases & tp_mro (GH-99342)

These slots are marked "should be treated as read-only" in the
table at the start of the document.  That doesn't say anything about
setting them in the static struct.

`tp_bases` docs did say that it should be ``NULL`` (TIL!). If you
ignore that, seemingly nothing bad happens. However, some slots
may not be inherited, depending on which sub-slot structs are present.
(FWIW, NumPy sets tp_bases and is affected by the quirk -- though to
be fair, its DUAL_INHERIT code probably predates tp_bases docs, and
also the result happens to be benign.)

This patch makes things explicit.
It also makes the summary table legend easier to scan.

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2 years agogh-51524: Fix bug when calling trace.CoverageResults with valid infile (#99629)
Furkan Onder [Mon, 28 Nov 2022 06:49:10 +0000 (09:49 +0300)] 
gh-51524: Fix bug when calling trace.CoverageResults with valid infile (#99629)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2 years agoDocs: both sqlite3 "point examples" now adapt to str (#99823)
Erlend E. Aasland [Sun, 27 Nov 2022 21:08:30 +0000 (22:08 +0100)] 
Docs: both sqlite3 "point examples" now adapt to str (#99823)

2 years agogh-91340: Document multiprocessing.set_start_method force parameter (GH-32339)
Sam Ezeh [Sun, 27 Nov 2022 17:58:39 +0000 (17:58 +0000)] 
gh-91340: Document multiprocessing.set_start_method force parameter (GH-32339)

#91340

https://bugs.python.org/issue47184

Automerge-Triggered-By: GH:kumaraditya303
2 years agoDocs: Move .PHONY to each section to avoid copy/paste omissions (#99396)
Hugo van Kemenade [Sun, 27 Nov 2022 17:48:29 +0000 (19:48 +0200)] 
Docs: Move .PHONY to each section to avoid copy/paste omissions (#99396)

2 years agogh-99677: Deduplicate self-type in `mro` in `inspect._getmembers` (#99678)
Nikita Sobolev [Sun, 27 Nov 2022 11:15:26 +0000 (14:15 +0300)] 
gh-99677: Deduplicate self-type in `mro` in `inspect._getmembers` (#99678)

Closes #99677

2 years agogh-99815: remove unused 'invalid' sentinel value and code that checks for it in inspe...
Anthony Sottile [Sun, 27 Nov 2022 11:01:02 +0000 (06:01 -0500)] 
gh-99815: remove unused 'invalid' sentinel value and code that checks for it in inspect.signature parsing (GH-21104)

2 years agoGH-87235: Make sure "python /dev/fd/9 9</path/to/script.py" works on macOS (#99768)
Ronald Oussoren [Sun, 27 Nov 2022 10:56:14 +0000 (11:56 +0100)] 
GH-87235: Make sure "python /dev/fd/9 9</path/to/script.py" works on macOS (#99768)

On macOS all file descriptors for a particular file in /dev/fd
share the same file offset, that is ``open("/dev/fd/9", "r")`` behaves
more like ``dup(9)`` than a regular open.

This causes problems when a user tries to run "/dev/fd/9" as a script
because zipimport changes the file offset to try to read a zipfile
directory. Therefore change zipimport to reset the file offset after
trying to read the zipfile directory.

2 years agoRemove unused local variables in inspect.py (#24218)
Yonatan Goldschmidt [Sun, 27 Nov 2022 10:39:23 +0000 (12:39 +0200)] 
Remove unused local variables in inspect.py (#24218)

2 years agogh-85988: Change documentation for sys.float_info.rounds (GH-99675)
Brad Wolfe [Sun, 27 Nov 2022 10:25:12 +0000 (11:25 +0100)] 
gh-85988: Change documentation for sys.float_info.rounds (GH-99675)

* Change documentation for sys.float_info.rounds

Change the documentation for sys.float_info.rounds to remove
references to C99 section 5.2.4.2.2 and instead place the
available values inline.

* Correction to previous documentation change

Newlines were not preserved in generated HTML on previous
commit. I have changes the list to a comma-separated list
of values and their meanings.

* Clarify source for value of FLT_ROUNDS

Clarify the source of the FLT_ROUNDS value and
change 'floating-point addition' to 'floating-point
arithmetic' to indicate that the rounding mode
applies to all arithmetic operations.

2 years agodoc: Remove backslashes in doctest grammar docs (#29346)
George Zhang [Sun, 27 Nov 2022 06:38:39 +0000 (01:38 -0500)] 
doc: Remove backslashes in doctest grammar docs (#29346)

2 years agobpo-43327: Fix the docs for PyImport_ImportFrozenModuleObject() (#24659)
Zackery Spytz [Sun, 27 Nov 2022 06:27:41 +0000 (22:27 -0800)] 
bpo-43327: Fix the docs for PyImport_ImportFrozenModuleObject() (#24659)

The docs stated that PyImport_ImportFrozenModuleObject() returns a
new reference, but it actually returns an int.

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2 years agoGH-66285: fix forking in asyncio (#99769)
Kumar Aditya [Sun, 27 Nov 2022 05:54:48 +0000 (11:24 +0530)] 
GH-66285: fix forking in asyncio (#99769)

Closes #66285

2 years agobpo-45975: Simplify some while-loops with walrus operator (GH-29347)
Nick Drozd [Sat, 26 Nov 2022 22:33:25 +0000 (16:33 -0600)] 
bpo-45975: Simplify some while-loops with walrus operator (GH-29347)

2 years agogh-89682: [doc] reword docstring of __contains__ to clarify that it returns a bool...
Ivan Savov [Sat, 26 Nov 2022 22:24:04 +0000 (17:24 -0500)] 
gh-89682: [doc] reword docstring of __contains__ to clarify that it returns a bool (GH-29043)

2 years agogh-88330: Add more detail about what is a resource. (#99801)
Jason R. Coombs [Sat, 26 Nov 2022 21:57:20 +0000 (16:57 -0500)] 
gh-88330: Add more detail about what is a resource. (#99801)

2 years agogh-98108: Add limited pickleability to zipfile.Path (GH-98109)
Jason R. Coombs [Sat, 26 Nov 2022 18:05:41 +0000 (13:05 -0500)] 
gh-98108: Add limited pickleability to zipfile.Path (GH-98109)

* gh-98098: Move zipfile into a package.

* Moved test_zipfile to a package

* Extracted module for test_path.

* Add blurb

* Add jaraco as owner of zipfile.Path.

* Synchronize with minor changes found at jaraco/zipp@d9e7f4352d.

* gh-98108: Sync with zipp 3.9.1 adding pickleability.

2 years agogh-99795: Fix typo in importlib.resources.abc (GH-99796)
busywhitespace [Sat, 26 Nov 2022 18:01:08 +0000 (19:01 +0100)] 
gh-99795: Fix typo in importlib.resources.abc (GH-99796)

Changing TraversableReader to TraversableResources at one place of the documentation.

See #99795 for more details.

2 years agoFix zipfile packaging after GH-98103 (GH-99797)
Jason R. Coombs [Sat, 26 Nov 2022 18:00:05 +0000 (13:00 -0500)] 
Fix zipfile packaging after GH-98103 (GH-99797)

* Add zipfile and test_zipfile to list of packages. Fixes regression introduced in #98103.

* Restore support for py -m test.test_zipfile

2 years agogh-91078: Return None from TarFile.next when the tarfile is empty (GH-91850)
Sam Ezeh [Sat, 26 Nov 2022 17:57:05 +0000 (17:57 +0000)] 
gh-91078: Return None from TarFile.next when the tarfile is empty (GH-91850)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2 years agogh-98098: Create packages from zipfile and test_zipfile (gh-98103)
Jason R. Coombs [Sat, 26 Nov 2022 14:44:13 +0000 (09:44 -0500)] 
gh-98098: Create packages from zipfile and test_zipfile (gh-98103)

* gh-98098: Move zipfile into a package.

* Moved test_zipfile to a package

* Extracted module for test_path.

* Add blurb

* Add jaraco as owner of zipfile.Path.

* Synchronize with minor changes found at jaraco/zipp@d9e7f4352d.

2 years agogh-97966: Restore prior expectation that uname_result._fields and ._asdict would...
Jason R. Coombs [Sat, 26 Nov 2022 13:28:49 +0000 (08:28 -0500)] 
gh-97966: Restore prior expectation that uname_result._fields and ._asdict would include the processor. (gh-98343)

2 years agogh-99086: Fix -Wstrict-prototypes, -Wimplicit-function-declaration warnings in config...
Sam James [Sat, 26 Nov 2022 13:08:49 +0000 (13:08 +0000)] 
gh-99086: Fix -Wstrict-prototypes, -Wimplicit-function-declaration warnings in configure.ac (#99406)

Follow up to 12078e78f6e4a21f344e4eaff529e1ff3b97734f.

2 years agogh-99502: mention bytes-like objects as input in `secrets.compare_digest` (GH-99512)
Nikita Sobolev [Sat, 26 Nov 2022 09:33:48 +0000 (12:33 +0300)] 
gh-99502: mention bytes-like objects as input in `secrets.compare_digest` (GH-99512)

Now it is in sync with https://docs.python.org/3/library/hmac.html#hmac.compare_digest
It is the same function, just re-exported. So, I guess they should mention the same input types.

2 years agoGH-95896: posixmodule.c: fix osdefs.h inclusion to not depend on compiler (#95897)
TheShermanTanker [Sat, 26 Nov 2022 09:31:42 +0000 (17:31 +0800)] 
GH-95896: posixmodule.c: fix osdefs.h inclusion to not depend on compiler (#95897)

Co-authored-by: Steve Dower <steve.dower@python.org>
2 years agoFix typo in `__match_args__` doc (#99785)
Terry Jan Reedy [Sat, 26 Nov 2022 00:03:16 +0000 (19:03 -0500)] 
Fix typo in `__match_args__` doc (#99785)

A opy of #98549, whose author (@icecream17) uses a school computer that blocks the CLA site. I did not mention this in commit comment above so CLA bot does not pick up the name and request the CLA again.

2 years agogh-98724: Fix warnings on Py_SETREF() usage (#99781)
Victor Stinner [Fri, 25 Nov 2022 23:30:37 +0000 (00:30 +0100)] 
gh-98724: Fix warnings on Py_SETREF() usage (#99781)

Cast argument to the expected type.

2 years agogh-99029: Fix handling of `PureWindowsPath('C:\<blah>').relative_to('C:')` (GH-99031)
Barney Gale [Fri, 25 Nov 2022 19:15:57 +0000 (19:15 +0000)] 
gh-99029: Fix handling of `PureWindowsPath('C:\<blah>').relative_to('C:')` (GH-99031)

`relative_to()` now treats naked drive paths as relative. This brings its
behaviour in line with other parts of pathlib, and with `ntpath.relpath()`,
and so allows us to factor out the pathlib-specific implementation.

2 years agogh-64019: Have attribute table in `inspect` docs link to module attributes instead...
Stanley [Fri, 25 Nov 2022 19:10:22 +0000 (11:10 -0800)] 
gh-64019: Have attribute table in `inspect` docs link to module attributes instead of listing them (GH-98116)

Co-authored-by: Michael Anckaert <michael.anckaert@sinax.be>
2 years agoFix typo on inline comment for email.generator (GH-98210)
Gary Donovan [Fri, 25 Nov 2022 18:03:20 +0000 (05:03 +1100)] 
Fix typo on inline comment for email.generator (GH-98210)

Trivial change to comment - no issue or new entry necessary

2 years agobpo-40882: Fix a memory leak in SharedMemory on Windows (GH-20684)
Zackery Spytz [Fri, 25 Nov 2022 17:39:48 +0000 (09:39 -0800)] 
bpo-40882: Fix a memory leak in SharedMemory on Windows (GH-20684)

In multiprocessing.shared_memory.SharedMemory(), the temporary view
returned by MapViewOfFile() should be unmapped when it is no longer
needed.

2 years agogh-96168: Add sqlite3 row factory how-to (#99507)
Erlend E. Aasland [Fri, 25 Nov 2022 13:07:28 +0000 (14:07 +0100)] 
gh-96168: Add sqlite3 row factory how-to (#99507)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2 years agobpo-38031: Fix a possible assertion failure in _io.FileIO() (#GH-5688)
Zackery Spytz [Fri, 25 Nov 2022 12:55:26 +0000 (04:55 -0800)] 
bpo-38031: Fix a possible assertion failure in _io.FileIO() (#GH-5688)

2 years agobpo-41260: C impl of datetime.date.strftime() takes different keyword arg (GH-21712)
Zackery Spytz [Fri, 25 Nov 2022 09:21:25 +0000 (01:21 -0800)] 
bpo-41260: C impl of datetime.date.strftime() takes different keyword arg (GH-21712)

2 years agoRevert "gh-98724: Fix Py_CLEAR() macro side effects" (#99737)
Victor Stinner [Thu, 24 Nov 2022 21:17:33 +0000 (22:17 +0100)] 
Revert "gh-98724: Fix Py_CLEAR() macro side effects" (#99737)

Revert "gh-98724: Fix Py_CLEAR() macro side effects (#99100)"

This reverts commit c03e05c2e72f3ea5e797389e7d1042eef85ad37a.

2 years agogh-64490: Fix bugs in argument clinic varargs processing (#32092)
colorfulappl [Thu, 24 Nov 2022 19:56:50 +0000 (03:56 +0800)] 
gh-64490: Fix bugs in argument clinic varargs processing (#32092)

2 years agoGH-66285: Revert "fix forking in asyncio" (#99756)
Kumar Aditya [Thu, 24 Nov 2022 17:34:21 +0000 (23:04 +0530)] 
GH-66285: Revert "fix forking in asyncio" (#99756)

2 years agoFix rendering of audioop license in Doc/license.rst (GH-99752)
Zachary Ware [Thu, 24 Nov 2022 16:18:40 +0000 (10:18 -0600)] 
Fix rendering of audioop license in Doc/license.rst (GH-99752)

Also some cosmetic blank line additions for consistency with the
formatting of the rest of the file.

2 years agoGH-66285: skip asyncio fork tests for platforms without md5 hash (#99745)
Kumar Aditya [Thu, 24 Nov 2022 16:06:06 +0000 (21:36 +0530)] 
GH-66285: skip asyncio fork tests for platforms without md5 hash  (#99745)

Such buildbots (at the time of writing, only "AMD64 RHEL8 FIPS Only Blake2 Builtin Hash 3.x") cannot use multiprocessing with a fork server, so just skip the test there.

2 years agoGH-79033: Fix asyncio.Server.wait_closed() (#98582)
Guido van Rossum [Thu, 24 Nov 2022 15:32:58 +0000 (07:32 -0800)] 
GH-79033: Fix asyncio.Server.wait_closed() (#98582)

It was a no-op when used as recommended (after close()).

I had to debug one test (test__sock_sendfile_native_failure) --
the cleanup sequence for the test fixture was botched.

Hopefully that's not a portend of problems in user code --
this has never worked so people may well be doing this wrong. :-(

Co-authored-by: kumar aditya
2 years agogh-99240: Fix double-free bug in Argument Clinic str_converter generated code (GH...
colorfulappl [Thu, 24 Nov 2022 14:01:26 +0000 (22:01 +0800)] 
gh-99240: Fix double-free bug in Argument Clinic str_converter generated code (GH-99241)

Fix double-free bug mentioned at https://github.com/python/cpython/issues/99240,
by moving memory clean up out of "exit" label.

Automerge-Triggered-By: GH:erlend-aasland
2 years agogh-64490: Fix refcount error when arguments are packed to tuple in argument clinic...
colorfulappl [Thu, 24 Nov 2022 12:24:18 +0000 (20:24 +0800)] 
gh-64490: Fix refcount error when arguments are packed to tuple in argument clinic (#99233)

2 years agogh-99708: fix bug where compiler crashes on if expression with an empty body block...
Irit Katriel [Thu, 24 Nov 2022 10:59:07 +0000 (10:59 +0000)] 
gh-99708: fix bug where compiler crashes on if expression with an empty body block (GH-99732)

2 years agogh-94808: [coverage] Add an asynchronous generator test where the generator is alread...
zhanpon [Thu, 24 Nov 2022 09:10:38 +0000 (18:10 +0900)] 
gh-94808: [coverage] Add an asynchronous generator test where the generator is already running (#97672)

2 years agogh-98872: Fix a possible resource leak in Python 3.11.0 (GH-99047)
SQLPATCH [Thu, 24 Nov 2022 09:04:19 +0000 (17:04 +0800)] 
gh-98872: Fix a possible resource leak in Python 3.11.0 (GH-99047)

Issue: #98872

Automerge-Triggered-By: GH:kumaraditya303
2 years agogh-99706: unicodeobject: Fix padding in `PyASCIIObject.state` (GH-99707)
David Hewitt [Thu, 24 Nov 2022 08:21:59 +0000 (08:21 +0000)] 
gh-99706: unicodeobject: Fix padding in `PyASCIIObject.state` (GH-99707)

2 years agoadd Kumar Aditya as `asyncio` codeowner (GH-99744)
Kumar Aditya [Thu, 24 Nov 2022 06:56:54 +0000 (12:26 +0530)] 
add Kumar Aditya as `asyncio` codeowner (GH-99744)

Automerge-Triggered-By: GH:kumaraditya303
2 years agoGH-66285: fix forking in `asyncio` (#99539)
Kumar Aditya [Thu, 24 Nov 2022 03:40:27 +0000 (09:10 +0530)] 
GH-66285: fix forking in `asyncio` (#99539)

`asyncio` now does not shares event loop and signal wakeupfd in forked processes.

2 years agogh-96828: Add an `ssl.OP_ENABLE_KTLS` option (GH-96830)
Illia Volochii [Thu, 24 Nov 2022 02:24:09 +0000 (04:24 +0200)] 
gh-96828: Add an `ssl.OP_ENABLE_KTLS` option (GH-96830)

Expose the constant when OpenSSL defines it.

2 years agocloses gh-99508: fix `TypeError` in `Lib/importlib/_bootstrap_external.py` (GH-99635)
Nikita Sobolev [Wed, 23 Nov 2022 22:47:31 +0000 (01:47 +0300)] 
closes gh-99508: fix `TypeError` in `Lib/importlib/_bootstrap_external.py` (GH-99635)

2 years agoUpload NEWS file as artifact (#30419)
Hugo van Kemenade [Wed, 23 Nov 2022 22:32:09 +0000 (00:32 +0200)] 
Upload NEWS file as artifact (#30419)

Co-authored-by: Éric <earaujo@caravan.coop>
2 years agoUse faster APIs to calculate paths at startup for Store packaged Python on Windows...
Steve Dower [Wed, 23 Nov 2022 19:50:15 +0000 (19:50 +0000)] 
Use faster APIs to calculate paths at startup for Store packaged Python on Windows (GH-99345)

2 years agogh-79315: Add Include/cpython/memoryobject.h header (#99723)
Victor Stinner [Wed, 23 Nov 2022 14:44:42 +0000 (15:44 +0100)] 
gh-79315: Add Include/cpython/memoryobject.h header (#99723)

Move non-limited C API from Include/memoryobject.h to a new
Include/cpython/memoryobject.h header file.

2 years agogh-99537: Use Py_SETREF(var, NULL) in C code (#99687)
Victor Stinner [Wed, 23 Nov 2022 13:57:50 +0000 (14:57 +0100)] 
gh-99537: Use Py_SETREF(var, NULL) in C code (#99687)

Replace "Py_DECREF(var); var = NULL;" with "Py_SETREF(var, NULL);".

2 years agogh-99619: fix error in documentation of ExceptionGroup.derive() (GH-99621)
Irit Katriel [Wed, 23 Nov 2022 10:59:52 +0000 (10:59 +0000)] 
gh-99619: fix error in documentation of ExceptionGroup.derive() (GH-99621)

2 years agoGH-95283: Add note about compilers in Mac/README.txt (#99506)
Ronald Oussoren [Wed, 23 Nov 2022 10:52:12 +0000 (11:52 +0100)] 
GH-95283: Add note about compilers in Mac/README.txt (#99506)

The build machinery assumes that the compiler that's used
to build on macOS includes an SDK that's at least as new
as the OS version on the build machine. Explicitly mention
this in Mac/README.txt.

2 years agoGH-98831: Add `macro` and `op` and their implementation to DSL (#99495)
Guido van Rossum [Wed, 23 Nov 2022 00:04:57 +0000 (16:04 -0800)] 
GH-98831: Add `macro` and `op` and their implementation to DSL (#99495)

Newly supported interpreter definition syntax:
- `op(NAME, (input_stack_effects -- output_stack_effects)) { ... }`
- `macro(NAME) = OP1 + OP2;`

Also some other random improvements:
- Convert `WITH_EXCEPT_START` to use stack effects
- Fix lexer to balk at unrecognized characters, e.g. `@`
- Fix moved output names; support object pointers in cache
- Introduce `error()` method to print errors
- Introduce read_uint16(p) as equivalent to `*p`

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2 years agogh-99300: Replace Py_INCREF() with Py_NewRef() in _elementtree.c (#99696)
Victor Stinner [Tue, 22 Nov 2022 21:17:06 +0000 (22:17 +0100)] 
gh-99300: Replace Py_INCREF() with Py_NewRef() in _elementtree.c (#99696)

* Replace Py_INCREF() and Py_XINCREF() using a cast with Py_NewRef()
  and Py_XNewRef() in Modules/_elementtree.c.
* Make reference counting more explicit: don't steal implicitly a
  reference on PyList_SET_ITEM(), use Py_NewRef() instead.
* Replace PyModule_AddObject() with PyModule_AddObjectRef().

2 years agogh-99650 : Updated argparse docs (GH-99653)
ram vikram singh [Tue, 22 Nov 2022 21:16:06 +0000 (02:46 +0530)] 
gh-99650 : Updated argparse docs (GH-99653)

2 years agogh-88226: Emit TARGET labels in Python/ceval.c when debugging, even if computed gotos...
Skip Montanaro [Tue, 22 Nov 2022 20:13:54 +0000 (14:13 -0600)] 
gh-88226: Emit TARGET labels in Python/ceval.c when debugging, even if computed gotos aren't enabled (GH-98265)

Keep target labels when debugging, but don't warn about lack of use.

Co-authored-by: Eryk Sun <eryksun@gmail.com>
2 years agogh-99146 struct module documentation should have more predictable examples/warnings...
Skip Montanaro [Tue, 22 Nov 2022 18:06:36 +0000 (12:06 -0600)] 
gh-99146 struct module documentation should have more predictable examples/warnings (GH-99141)

* nail down a couple examples to have more predictable output

* update a number of things, but this is really just a stash...

* added an applications section to describe typical uses for native and machine-independent formats

* make sure all format strings use a format prefix character

* responding to comments from @gpshead. Not likely finished yet.

* This got more involved than I expected...

* respond to several PR comments
* a lot of wordsmithing
* try and be more consistent in use of ``x`` vs ``'x'``
* expand examples a bit
* update the "see also" to be more up-to-date
* original examples relied on import * so present all examples as if

* reformat based on @gpshead comment (missed before)

* responding to comments

* missed this

* one more suggested edit

* wordsmithing

2 years agoUpdate Visual Studio solution to build all extension modules on F5 (GH-99667)
Steve Dower [Tue, 22 Nov 2022 17:20:47 +0000 (17:20 +0000)] 
Update Visual Studio solution to build all extension modules on F5 (GH-99667)

Without these "forward" dependencies, VS would only build as far as necessary to launch the selected project.

2 years agogh-99547: Add isjunction methods for checking if a path is a junction (GH-99548)
Charles Machalow [Tue, 22 Nov 2022 17:19:34 +0000 (09:19 -0800)] 
gh-99547: Add isjunction methods for checking if a path is a junction (GH-99548)

2 years agogh-99645: Fix a bug in handling class cleanups in unittest.TestCase (GH-99646)
Serhiy Storchaka [Tue, 22 Nov 2022 15:49:37 +0000 (17:49 +0200)] 
gh-99645: Fix a bug in handling class cleanups in unittest.TestCase (GH-99646)

Now addClassCleanup() uses separate lists for different TestCase subclasses,
and doClassCleanups() only cleans up the particular class.

2 years agogh-93937: Document PyFrame_Check and PyFrame_Type (GH-99695)
Petr Viktorin [Tue, 22 Nov 2022 15:41:57 +0000 (16:41 +0100)] 
gh-93937: Document PyFrame_Check and PyFrame_Type (GH-99695)

2 years agogh-88863: Clear ref cycles to resolve leak when asyncio.open_connection raises (...
Dong Uk, Kang [Tue, 22 Nov 2022 15:06:20 +0000 (00:06 +0900)] 
gh-88863: Clear ref cycles to resolve leak when asyncio.open_connection raises (#95739)

Break reference cycles to resolve memory leak, by
removing local exception and future instances from the frame

2 years agogh-99537: Use Py_CLEAR() function in C code (#99686)
Victor Stinner [Tue, 22 Nov 2022 14:22:55 +0000 (15:22 +0100)] 
gh-99537: Use Py_CLEAR() function in C code (#99686)

Replace "Py_XDECREF(var); var = NULL;" with "Py_CLEAR(var);".

Don't replace "Py_DECREF(var); var = NULL;" with "Py_CLEAR(var);". It
would add an useless "if (var)" test in code path where var cannot be
NULL.

2 years agogh-99537: Use Py_SETREF() function in C code (#99656)
Victor Stinner [Tue, 22 Nov 2022 13:22:22 +0000 (14:22 +0100)] 
gh-99537: Use Py_SETREF() function in C code (#99656)

Fix potential race condition in code patterns:

* Replace "Py_DECREF(var); var = new;" with "Py_SETREF(var, new);"
* Replace "Py_XDECREF(var); var = new;" with "Py_XSETREF(var, new);"
* Replace "Py_CLEAR(var); var = new;" with "Py_XSETREF(var, new);"

Other changes:

* Replace "old = var; var = new; Py_DECREF(var)"
  with "Py_SETREF(var, new);"
* Replace "old = var; var = new; Py_XDECREF(var)"
  with "Py_XSETREF(var, new);"
* And remove the "old" variable.

2 years agogh-99537: Use Py_SETREF() function in C code (#99657)
Victor Stinner [Tue, 22 Nov 2022 12:39:11 +0000 (13:39 +0100)] 
gh-99537: Use Py_SETREF() function in C code (#99657)

Fix potential race condition in code patterns:

* Replace "Py_DECREF(var); var = new;" with "Py_SETREF(var, new);"
* Replace "Py_XDECREF(var); var = new;" with "Py_XSETREF(var, new);"
* Replace "Py_CLEAR(var); var = new;" with "Py_XSETREF(var, new);"

Other changes:

* Replace "old = var; var = new; Py_DECREF(var)"
  with "Py_SETREF(var, new);"
* Replace "old = var; var = new; Py_XDECREF(var)"
  with "Py_XSETREF(var, new);"
* And remove the "old" variable.

2 years agogh-91053: Add an optional callback that is invoked whenever a function is modified...
mpage [Tue, 22 Nov 2022 12:06:44 +0000 (04:06 -0800)] 
gh-91053: Add an optional callback that is invoked whenever a function is modified (#98175)

2 years agogh-99537: Use Py_SETREF() function in longobject C code (#99655)
Victor Stinner [Tue, 22 Nov 2022 12:04:19 +0000 (13:04 +0100)] 
gh-99537: Use Py_SETREF() function in longobject C code (#99655)

Replace "Py_DECREF(var); var = new;" with "Py_SETREF(var, new);"
in longobject.c and _testcapi/long.c.

2 years agogh-99341: Cover type ignore nodes when incrementing line numbers (GH-99422)
Batuhan Taskaya [Tue, 22 Nov 2022 10:41:14 +0000 (13:41 +0300)] 
gh-99341: Cover type ignore nodes when incrementing line numbers (GH-99422)

2 years agoGH-92892: Add section about variadic functions to ctypes documentation (#99529)
Ronald Oussoren [Tue, 22 Nov 2022 10:33:37 +0000 (11:33 +0100)] 
GH-92892: Add section about variadic functions to ctypes documentation (#99529)

On some platforms, and in particular macOS/arm64, the calling
convention for variadic arguments is different from the regular
calling convention. Add a section to the documentation to document
this.

2 years agoGH-97001: Release GIL in termios extension (#99503)
Ronald Oussoren [Tue, 22 Nov 2022 10:14:23 +0000 (11:14 +0100)] 
GH-97001: Release GIL in termios extension (#99503)

Without releasing the GIL calls to termios APIs might block the entire interpreter.

2 years agogh-47146: Soft-deprecate structmember.h, expose its contents via Python.h (GH-99014)
Petr Viktorin [Tue, 22 Nov 2022 07:25:43 +0000 (08:25 +0100)] 
gh-47146: Soft-deprecate structmember.h, expose its contents via Python.h (GH-99014)

The ``structmember.h`` header is deprecated, though it continues to be available
and there are no plans to remove it. There are no deprecation warnings. Old code
can stay unchanged (unless the extra include and non-namespaced macros bother
you greatly). Specifically, no uses in CPython are updated -- that would just be
unnecessary churn.
The ``structmember.h`` header is deprecated, though it continues to be
available and there are no plans to remove it.

Its contents are now available just by including ``Python.h``,
with a ``Py`` prefix added if it was missing:

- `PyMemberDef`, `PyMember_GetOne` and`PyMember_SetOne`
- Type macros like `Py_T_INT`, `Py_T_DOUBLE`, etc.
  (previously ``T_INT``, ``T_DOUBLE``, etc.)
- The flags `Py_READONLY` (previously ``READONLY``) and
  `Py_AUDIT_READ` (previously all uppercase)

Several items are not exposed from ``Python.h``:

- `T_OBJECT` (use `Py_T_OBJECT_EX`)
- `T_NONE` (previously undocumented, and pretty quirky)
- The macro ``WRITE_RESTRICTED`` which does nothing.
- The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents of
  `Py_AUDIT_READ`.
- In some configurations, ``<stddef.h>`` is not included from ``Python.h``.
  It should be included manually when using ``offsetof()``.

The deprecated header continues to provide its original
contents under the original names.
Your old code can stay unchanged, unless the extra include and non-namespaced
macros bother you greatly.

There is discussion on the issue to rename `T_PYSSIZET` to `PY_T_SSIZE` or
similar. I chose not to do that -- users will probably copy/paste that with any
spelling, and not renaming it makes migration docs simpler.

Co-Authored-By: Alexander Belopolsky <abalkin@users.noreply.github.com>
Co-Authored-By: Matthias Braun <MatzeB@users.noreply.github.com>
2 years agogh-99662: fix typo in typing.TypeVarTuple docs (#99672)
GabrielAnguita [Tue, 22 Nov 2022 04:02:55 +0000 (01:02 -0300)] 
gh-99662: fix typo in typing.TypeVarTuple docs (#99672)

2 years agogh-99659: Use correct exceptions in sqlite3 bigmem tests (#99660)
Łukasz Langa [Mon, 21 Nov 2022 20:44:17 +0000 (21:44 +0100)] 
gh-99659: Use correct exceptions in sqlite3 bigmem tests (#99660)

The tests in question were added in 0eec6276fdcd by Serhiy. Apparently,
sqlite3 changed exceptions raised in those cases in the mean time but
the tests never ran because they require a high `-M` setting in the
test runner.

2 years agogh-98629: Fixes sys._git and sys.version creation on Windows (GH-99664)
Steve Dower [Mon, 21 Nov 2022 20:42:18 +0000 (20:42 +0000)] 
gh-98629: Fixes sys._git and sys.version creation on Windows (GH-99664)

2 years agogh-96002: Add functional test for Argument Clinic (#96178)
colorfulappl [Mon, 21 Nov 2022 14:08:45 +0000 (22:08 +0800)] 
gh-96002: Add functional test for Argument Clinic (#96178)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agoAdd more details in test_unittest (GH-99626)
Serhiy Storchaka [Mon, 21 Nov 2022 11:57:30 +0000 (13:57 +0200)] 
Add more details in test_unittest (GH-99626)

2 years agogh-99578: Fix refleak in _imp.create_builtin() (#99642)
Victor Stinner [Mon, 21 Nov 2022 11:14:54 +0000 (12:14 +0100)] 
gh-99578: Fix refleak in _imp.create_builtin() (#99642)

Fix a reference bug in _imp.create_builtin() after the creation of
the first sub-interpreter for modules "builtins" and "sys".

2 years agoGH-95815: Document less specific error for os.remove (#99571)
Ronald Oussoren [Mon, 21 Nov 2022 10:08:06 +0000 (11:08 +0100)] 
GH-95815: Document less specific error for os.remove (#99571)

os.remove can raise PermissionError instead of IsADirectoryError,
when the object to be removed is a directory (in particular on
macOS).

This reverts a change done in #14262.

2 years agogh-99337: Fix compile errors with gcc 12 on macOS (#99470)
Ronald Oussoren [Mon, 21 Nov 2022 09:50:20 +0000 (10:50 +0100)] 
gh-99337: Fix compile errors with gcc 12 on macOS (#99470)

Fix a number of compile errors with GCC-12 on macOS:

1. In pylifecycle.c the compile rejects _Pragma within a declaration
2. posixmodule.c was missing a number of ..._RUNTIME macros for non-clang on macOS
3. _ctypes assumed that __builtin_available is always present on macOS