Commit Graph

120942 Commits

Author SHA1 Message Date
Serhiy Storchaka 79811ededd
gh-115886: Handle embedded null characters in shared memory name (GH-115887)
shm_open() and shm_unlink() now check for embedded null characters in
the name and raise an error instead of silently truncating it.
2024-02-25 11:31:03 +02:00
Oh seungmin 5770006ffa
Add an example of of custom `__repr__` (#112761)
Added to repr entry in Doc/library/functions.rst.

---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-02-25 02:59:35 -05:00
Adorilson Bezerra f7455864f2
Erase some unnecessary quotes on data model doc (#113521)
Thanks to Pedro Arthur Duarte (pedroarthur.jedi at gmail.com) for help with this bug.
2024-02-24 19:16:19 -05:00
Jay Ting 948acd6ed8
gh-115323: Add meaningful error message for using bytearray.extend with str (#115332)
Perform str check after TypeError is raised
---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-02-24 18:34:45 -05:00
Barney Gale e3dedeae7a
GH-114610: Fix `pathlib.PurePath.with_stem('')` handling of file extensions (#114612)
Raise `ValueError` if `with_stem('')` is called on a path with a file
extension. Paths may only have an empty stem if they also have an empty
suffix.
2024-02-24 19:37:03 +00:00
Raymond Hettinger 53c5c17e0a
gh-113202: Add whatsnew entry for the batched() strict option. (gh-115889) 2024-02-24 12:03:11 -06:00
partev 5251711868
gh-115872: Doc: remove obsolete reference to MSI packages (#115873) 2024-02-23 23:53:26 -07:00
Chris Markiewicz 200271c61d
gh-114763: Protect lazy loading modules from attribute access races (GH-114781)
Setting the __class__ attribute of a lazy-loading module to ModuleType enables other threads to attempt to access attributes before the loading is complete. Now that is protected by a lock.
2024-02-23 16:02:16 -08:00
jmcb ef6074b352
Insert missing apostrophes in ctypes documentation (#115090) 2024-02-23 14:55:47 -08:00
Serhiy Storchaka c688c0f130
gh-67044: Always quote or escape \r and \n in csv.writer() (GH-115741) 2024-02-23 22:25:09 +02:00
Stanley 462a2fc09d
gh-54358: Clarify data chunking in pyexpat (GH-31629)
Co-authored-by: Éric Araujo <merwok@netwok.org>
2024-02-23 18:57:08 +00:00
Ken Jin 3d8fc06d4f
gh-115859: Disable the tier 2 redundancy eliminator by default (GH-115860) 2024-02-23 18:43:52 +00:00
Kirill Podoprigora e4561e0501
gh-115778: Add `tierN` annotation for instruction definitions (#115815)
This replaces the old `TIER_{ONE,TWO}_ONLY` macros. Note that `specialized` implies `tier1`.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-02-23 17:31:57 +00:00
Pablo Galindo Salgado 59057ce55a
gh-89480: Document the gdb helpers (GH-115657)
Content adapted from https://devguide.python.org/development-tools/gdb/#
and https://wiki.python.org/moin/DebuggingWithGdb.

The original content on the Wiki page came from gdb debug help used by
the Launchpad (https://launchpad.net/) team. 
Thanks to Anatoly Techtonik and user `rmf` for substantial improvements to the Wiki page.


The history of the Devguide page follows
(with log entries expanded for major content contributions):

Hugo van Kemenade, Sat Dec 30 21:22:04 2023 +0200
Hugo van Kemenade, Fri Dec 8 12:04:32 2023 +0200
Erlend E. Aasland & Hugo van Kemenade, Tue Aug 8 22:05:34 2023 +0200
Satish Mishra, Sat Feb 11 13:54:57 2023 +0530
Hugo van Kemenade, Fri Dec 23 17:33:33 2022 +0200
Skip Montanaro, Hugo, Erlend, & Ezio, Fri Nov 4 05:04:23 2022 -0500

    Add a GDB tips section to Advanced Tools (#977)
    
Adam Turner, Wed Jun 15 21:19:23 2022 +0100
Adam Turner, Tue Jun 14 11:12:26 2022 +0100
Suriyaa, Fri Jun 8 19:39:23 2018 +0200
Jeff Allen, Tue Oct 24 18:12:53 2017 +0100
Jeff Allen, Fri Oct 13 13:43:43 2017 +0100
Mariatta, Wed Jan 4 09:14:55 2017 -0800
Carol Willing, Mon Sep 26 14:50:54 2016 -0700
Zachary Ware, Thu Jul 21 10:42:23 2016 -0500
Georg Brandl, Mon Nov 3 11:28:19 2014 +0100

    Add instruction how to activate python-gdb.py

Georg Brandl, Sun Mar 9 10:32:01 2014 +0100
Georg Brandl, Tue Apr 3 09:12:53 2012 +0200
Georg Brandl, Sat Mar 5 17:32:35 2011 +0100
Dave Malcolm, Fri Jan 21 12:34:09 2011 -0500

    Add documentation on the gdb extension commands provided in libpython.py
    
    I adapted this from documentation I wrote for the Fedora wiki:
      https://fedoraproject.org/wiki/Features/EasierPythonDebugging#New_gdb_commands
    reformatting it as rst, and making other minor changes

Brett Cannon, Thu Jan 20 15:16:52 2011 -0800
Dave Malcolm, Thu Jan 20 16:17:23 2011 -0500

    Add some notes on the gdb pretty-printer hooks

Antoine Pitrou, Thu Jan 20 21:17:49 2011 +0100

    Give an example backtrace

Antoine Pitrou, Thu Jan 20 21:03:06 2011 +0100

    Expand explanations about gdb support

Brett Cannon, Thu Jan 20 11:33:36 2011 -0800

    Tweak the gdb support title to fit in better with the devguide.

Brett Cannon, Mon Jan 17 21:12:54 2011 +0000

    Short README on gdb support.


Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Co-authored-by: anatoly techtonik <techtonik@gmail.com>
Co-authored-by: Antoine Pitrou <solipsis@pitrou.net>
Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Dave Malcolm <dmalcolm@redhat.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Georg Brandl <georg@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Jeff Allen <ja.py@farowl.co.uk>
Co-authored-by: Mariatta <Mariatta@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Satish Mishra <7506satish@gmail.com>
Co-authored-by: Skip Montanaro <skip.montanaro@gmail.com>
Co-authored-by: Suriyaa <isc.suriyaa@gmail.com>
Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
2024-02-23 17:13:45 +01:00
Ken Jin 2ec50b4a66
gh-114058: Improve method information in redundancy eliminator (GH-115848) 2024-02-23 23:41:10 +08:00
Serhiy Storchaka acd6f41ecf
gh-111789: Use PyDict_GetItemRef() in Python/compile.c (GH-112083)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-02-23 12:35:27 +01:00
Erlend E. Aasland e74cd0f910
gh-115806: Make configure output more readable (#115807)
- make sure LDLIBRARY and HOSTRUNNER checks don't overlap
- make the ipv6 library check less subtle
2024-02-23 10:52:06 +01:00
Serhiy Storchaka 2e92ffd7fa
gh-90300: Reformat the Python CLI help output (GH-93415) 2024-02-23 10:27:07 +01:00
Nikita Sobolev e3f462c9a7
Remove `ConverterKeywordDict` alias in `clinic.py` (#115843) 2024-02-23 09:00:07 +00:00
Ken Jin a33ffe4785
gh-114058: More robust method handling in redundancy eliminator (GH-115779) 2024-02-23 15:42:03 +08:00
Brett Simmers a494a3dd8e
gh-115836: Don't use hardcoded line numbers in test_monitoring (#115837) 2024-02-23 03:14:17 +00:00
Ronald Oussoren b48101864c
gh-88516: show file proxy icon in IDLE editor windows on macOS (#112894)
The platform standard on macOS is to show a proxy icon for open
files in the titlebar of Windows. Make sure IDLE matches this
behaviour.

Don't use both the long and short names in the window title.
The behaviour of other editors (such as Text Editor) is to show
only the short name with the proxy icon.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-02-23 02:15:39 +00:00
Guido van Rossum 4ee6bdfbaa
gh-115727: Reduce confidence even on 100% predicted jumps (#115748)
The theory is that even if we saw a jump go in the same direction the
last 16 times we got there, we shouldn't be overly confident that it's
still going to go the same way in the future. This PR makes it so that
in the extreme cases, the confidence is multiplied by 0.9 instead of
remaining unchanged. For unpredictable jumps, there is no difference
(still 0.5). For somewhat predictable jumps, we interpolate.
2024-02-22 12:23:48 -08:00
Dino Viehland 1002fbe12e
gh-112075: Iterating a dict shouldn't require locks (#115108)
Makes iteration of a dict be lock free for the forward iteration case.
2024-02-22 12:02:39 -08:00
NewUserHa a3859422d1
Update http.cookiejar document for cookie object attributes (GH-101885) 2024-02-22 19:08:04 +00:00
Brandt Bucher 17dab2e572
GH-113464: Clean up JIT stencil generation (GH-115800) 2024-02-22 10:22:23 -08:00
Nikita Sobolev 465df8855e
gh-115827: Fix compile warning in `longobject.c` (#115828)
Objects/longobject.c:1186:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
2024-02-22 17:57:12 +00:00
Mark Shannon b348313e7a
GH-115651: Convert `LOAD_MODULE_ATTR` into `LOAD_INLINE_CONST` when the module is itself a constant. (GH-115711) 2024-02-22 14:48:25 +00:00
Seth Michael Larson c6a47de709
gh-115663: Remove 'regen-sbom' from the 'regen-all' target (#115790) 2024-02-22 15:42:26 +02:00
Irit Katriel 96c1737591
gh-115796: fix exception table construction in _testinternalcapi.assemble_code_object (#115797) 2024-02-22 12:36:44 +00:00
Petr Viktorin 8aa372edcd
gh-115714: Don't use CLOCK_PROCESS_CPUTIME_ID and times() on WASI (GH-115757)
* gh-115714: Don't use CLOCK_PROCESS_CPUTIME_ID and times() on WASI

* Add blurb
2024-02-22 12:39:45 +01:00
Erlend E. Aasland baae73d730
gh-115765: Don't use deprecated AC_CHECK_TYPE macro in configure.ac (#115792)
Instead use AC_CHECK_TYPES.
2024-02-22 10:04:15 +01:00
partev 7bc79371a6
gh-115795: Doc: fix obsolete URL (#115749) 2024-02-22 08:45:26 +02:00
Gregory P. Smith fac99b8b0d
gh-111140: Improve PyLong_AsNativeBytes API doc example & improve the test (#115380)
This expands the examples to cover both realistic use cases for the API.
    
I noticed thing in the test that could be done better so I added those as well: We need to guarantee that all bytes of the result are overwritten and that too many are not written.  Tests now pre-fills the result with data in order to ensure that.

Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2024-02-22 03:27:16 +00:00
Malcolm Smith 7f5e3f04f8
gh-111225: Link extension modules against libpython on Android (#115780)
Part of the work on PEP 738: Adding Android as a supported platform.

* Rename the LIBPYTHON variable to MODULE_LDFLAGS, to more accurately 
  reflect its purpose.
* Edit makesetup to use MODULE_LDFLAGS when linking extension modules.
* Edit the Makefile so that extension modules depend on libpython on 
  Android and Cygwin.
* Restore `-fPIC` on Android. It was removed several years ago with a 
  note that the toolchain used it automatically, but this is no longer
  the case. Omitting it causes all linker commands to fail with an error
  like `relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against
  symbol '_Py_FalseStruct'; recompile with -fPIC`.
2024-02-21 23:18:57 +00:00
Gabriele Catania 113687a838
gh-93205: When rotating logs with no namer specified, match whole extension (GH-93224) 2024-02-21 23:09:06 +02:00
Sam Gross 347acded84
gh-115491: Keep some fields valid across allocations in obmalloc (free-threading) (#115745) 2024-02-21 10:00:08 -08:00
AN Long 87a65a5bd4
gh-115304: Add doc for initializing PyMutex as a global variable (#115305) 2024-02-21 12:35:53 -05:00
Daniel Mach 5f7df88821
gh-96310: Fix a traceback in argparse when all options in a mutually exclusive group are suppressed (GH-96311)
Reproducer depends on terminal size - the traceback occurs when there's
an option long enough so the usage line doesn't fit the terminal width.
Option order is also important for reproducibility.

Excluding empty groups (with all options suppressed) from inserts
fixes the problem.
2024-02-21 13:58:04 +00:00
Petr Viktorin 4a9e6497c2
gh-104090: Add exit code to multiprocessing ResourceTracker (GH-115410)
This builds on https://github.com/python/cpython/pull/106807, which adds
a return code to ResourceTracker, to make future debugging easier.
Testing this “in situ” proved difficult, since the global ResourceTracker is
involved in test infrastructure. So, the tests here create a new instance and
feed it fake data.

---------

Co-authored-by: Yonatan Bitton <yonatan.bitton@perception-point.io>
Co-authored-by: Yonatan Bitton <bityob@gmail.com>
Co-authored-by: Antoine Pitrou <antoine@python.org>
2024-02-21 13:54:57 +01:00
Frank Dana b052fa381f
argparse: remove incoherent and redundant docstring for private method (GH-101591)
Signed-off-by: FeRD (Frank Dana) <ferdnyc@gmail.com>
2024-02-21 11:32:28 +00:00
Sebastian Pipping fbd40ce46e
gh-115399: Document CVE-2023-52425 under "XML vulnerabilities" (GH-115400)
Doc/library/xml.rst: Document CVE-2023-52425 under "XML vulnerabilities"
2024-02-21 12:26:16 +01:00
Victor Stinner e4c34f04a1
gh-110850: Cleanup PyTime API: PyTime_t are nanoseconds (#115753)
PyTime_t no longer uses an arbitrary unit, it's always a number of
nanoseconds (64-bit signed integer).

* Rename _PyTime_FromNanosecondsObject() to _PyTime_FromLong().
* Rename _PyTime_AsNanosecondsObject() to _PyTime_AsLong().
* Remove pytime_from_nanoseconds().
* Remove pytime_as_nanoseconds().
* Remove _PyTime_FromNanoseconds().
2024-02-21 11:46:00 +01:00
Frank Hoffmann 69ab93082d
gh-112364: Correct unparsing of backslashes and quotes in ast.unparse (#115696) 2024-02-21 10:24:08 +00:00
Russell Keith-Magee 074bbec9c4
gh-115737: Correct libpython install name for macOS shared library builds. (gh-115750) 2024-02-21 04:11:04 -05:00
Bogdan Romanyuk 10fc4675fd
gh-115653: Document PyCode_GetFirstFree() (#115654)
Correct the return type of the PyCode_GetNumFree() documentation.
2024-02-21 10:01:36 +01:00
Victor Stinner 77430b6a32
gh-110850: Replace private _PyTime_MAX with public PyTime_MAX (#115751)
Remove references to the old names _PyTime_MIN
and _PyTime_MAX, now that PyTime_MIN and
PyTime_MAX are public.

Replace also _PyTime_MIN with PyTime_MIN.
2024-02-21 08:11:40 +00:00
Benjamin Peterson 1235e84276
Delete unused sym_clear_flag function. (#115744) 2024-02-20 17:40:48 -08:00
Donghee Na 259730bbb5
gh-112087: Make list_{concat, repeat, inplace_repeat, ass_item) to be thread-safe (gh-115605) 2024-02-21 01:38:09 +00:00
Dino Viehland 54071460d7
gh-112075: Accessing a single element should optimistically avoid locking (#115109)
Makes accessing a single element thread safe and typically lock free
2024-02-20 17:08:14 -08:00