Commit Graph

115407 Commits

Author SHA1 Message Date
Géry Ogam 052bc128ac
Docs: improve accuracy of socketserver reference (#24767) 2022-11-29 21:34:52 +01:00
Yilei "Dolee" Yang d74a58872c
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.
2022-11-29 20:30:58 +00:00
Sam Ezeh 05dfc539c2
gh-90717: Update the documentation for the altchars paremeter in base64 library (GH-94187) 2022-11-29 16:21:01 +00:00
Victor Stinner 74d5f61ebd
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).
2022-11-29 12:15:21 +01:00
Victor Stinner 4246fe977d
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.
2022-11-29 12:12:17 +01:00
Kumar Aditya 4cfc1b8568
GH-91375: Port `_asyncio` static types to heap types and module state (#99122)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2022-11-29 15:37:37 +05:30
Serhiy Storchaka deaa8dee48
gh-99593: Add tests for Unicode C API (part 1) (GH-99651)
Add tests for functions corresponding to the str class methods.
2022-11-29 09:59:56 +02:00
Serhiy Storchaka 8f2fb7dfe7
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.
2022-11-29 09:46:52 +02:00
cemysce 1d1bb95abd
gh-99811: Use correct variable to search for time in format string (GH-99812)
Use correct variable to search for asctime
2022-11-28 18:25:03 +00:00
Matthew Hughes ca3e611b1f
`fnmatch` docs: link to `fnmatch.filter()`, not `builtins.filter()` (#99819) 2022-11-28 18:08:08 +00:00
Victor Stinner 7bae15cf37
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.
2022-11-28 17:42:22 +01:00
David Miguel Susano Pinto 65417988a5
Grammatical improvements for ctypes 'winmode' documentation (GH-19167) 2022-11-28 16:05:21 +00:00
Victor Stinner 02f72b8b93
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.
2022-11-28 16:40:08 +01:00
Zackery Spytz 53eef27133
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>
2022-11-28 16:16:40 +05:30
Georg Brandl 492dc02b01
bpo-41825: restructure docs for the os.wait*() family (GH-22356) 2022-11-28 09:41:24 +00:00
Petr Viktorin 219696abb2
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>
2022-11-28 09:22:08 +01:00
Furkan Onder 594de165bf
gh-51524: Fix bug when calling trace.CoverageResults with valid infile (#99629)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2022-11-28 01:49:10 -05:00
Erlend E. Aasland 276643e207
Docs: both sqlite3 "point examples" now adapt to str (#99823) 2022-11-27 22:08:30 +01:00
Sam Ezeh dfc2732a57
gh-91340: Document multiprocessing.set_start_method force parameter (GH-32339)
#91340


https://bugs.python.org/issue47184

Automerge-Triggered-By: GH:kumaraditya303
2022-11-27 09:58:39 -08:00
Hugo van Kemenade 969620d59a
Docs: Move .PHONY to each section to avoid copy/paste omissions (#99396) 2022-11-27 19:48:29 +02:00
Nikita Sobolev 2653b82c1a
gh-99677: Deduplicate self-type in `mro` in `inspect._getmembers` (#99678)
Closes #99677
2022-11-27 16:45:26 +05:30
Anthony Sottile ac115b51e7
gh-99815: remove unused 'invalid' sentinel value and code that checks for it in inspect.signature parsing (GH-21104) 2022-11-27 11:01:02 +00:00
Ronald Oussoren d08fb25769
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.
2022-11-27 11:56:14 +01:00
Yonatan Goldschmidt 9c9f085e9a
Remove unused local variables in inspect.py (#24218) 2022-11-27 16:09:23 +05:30
Brad Wolfe 65629399bc
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.
2022-11-27 10:25:12 +00:00
George Zhang 22860dbbc8
doc: Remove backslashes in doctest grammar docs (#29346) 2022-11-27 12:08:39 +05:30
Zackery Spytz 62a5dc13e9
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>
2022-11-27 11:57:41 +05:30
Kumar Aditya 191708c56c
GH-66285: fix forking in asyncio (#99769)
Closes #66285
2022-11-27 11:24:48 +05:30
Nick Drozd 024ac542d7
bpo-45975: Simplify some while-loops with walrus operator (GH-29347) 2022-11-26 14:33:25 -08:00
Ivan Savov 25bc115df9
gh-89682: [doc] reword docstring of __contains__ to clarify that it returns a bool (GH-29043) 2022-11-26 22:24:04 +00:00
Jason R. Coombs 7f005749b2
gh-88330: Add more detail about what is a resource. (#99801) 2022-11-26 16:57:20 -05:00
Jason R. Coombs 93f22d30eb
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.
2022-11-26 13:05:41 -05:00
busywhitespace 5f8898216e
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.
2022-11-26 10:01:08 -08:00
Jason R. Coombs 003f341e99
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
2022-11-26 13:00:05 -05:00
Sam Ezeh 78365b8e28
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>
2022-11-26 09:57:05 -08:00
Jason R. Coombs 7796d3179b
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.
2022-11-26 09:44:13 -05:00
Jason R. Coombs dc063a25d2
gh-97966: Restore prior expectation that uname_result._fields and ._asdict would include the processor. (gh-98343) 2022-11-26 08:28:49 -05:00
Sam James e35ca417fe
gh-99086: Fix -Wstrict-prototypes, -Wimplicit-function-declaration warnings in configure.ac (#99406)
Follow up to 12078e78f6.
2022-11-26 18:38:49 +05:30
Nikita Sobolev 47d673d81f
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.
2022-11-26 01:33:48 -08:00
TheShermanTanker ec2b76aa8b
GH-95896: posixmodule.c: fix osdefs.h inclusion to not depend on compiler (#95897)
Co-authored-by: Steve Dower <steve.dower@python.org>
2022-11-26 15:01:42 +05:30
Terry Jan Reedy a86d854522
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.
2022-11-26 00:03:16 +00:00
Victor Stinner 5556d3e02c
gh-98724: Fix warnings on Py_SETREF() usage (#99781)
Cast argument to the expected type.
2022-11-26 00:30:37 +01:00
Barney Gale ae234fbc5c
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.
2022-11-25 11:15:57 -08:00
Stanley 7d2dcc53d0
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>
2022-11-25 11:10:22 -08:00
Gary Donovan 5d4d83130c
Fix typo on inline comment for email.generator (GH-98210)
Trivial change to comment - no issue or new entry necessary
2022-11-25 10:03:20 -08:00
Zackery Spytz 85c128e34d
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.
2022-11-25 17:39:48 +00:00
Erlend E. Aasland 8749121b07
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>
2022-11-25 14:07:28 +01:00
Zackery Spytz d386115039
bpo-38031: Fix a possible assertion failure in _io.FileIO() (#GH-5688) 2022-11-25 12:55:26 +00:00
Zackery Spytz b1dcdefc3a
bpo-41260: C impl of datetime.date.strftime() takes different keyword arg (GH-21712) 2022-11-25 09:21:25 +00:00
Victor Stinner 3a803bcaac
Revert "gh-98724: Fix Py_CLEAR() macro side effects" (#99737)
Revert "gh-98724: Fix Py_CLEAR() macro side effects (#99100)"

This reverts commit c03e05c2e7.
2022-11-24 22:17:33 +01:00