Commit graph

110023 commits

Author SHA1 Message Date
Pablo Galindo bd7476dae3
bpo-44201: Avoid side effects of "invalid_*" rules in the REPL (GH-26298)
When the parser does a second pass to check for errors, these rules can
have some small side-effects as they may advance the parser more than
the point reached in the first pass. This can cause the tokenizer to ask
for extra tokens in interactive mode causing the tokenizer to show the
prompt instead of failing instantly.

To avoid this, add a new mode to the tokenizer that is activated in the
second pass and deactivates asking for new tokens when the interactive
line is finished. As the parsing should have reached the last line in
the first pass, the second pass should not need to ask for more tokens.
2021-05-22 23:05:00 +01:00
Erlend Egeberg Aasland 2a1e6698b1
bpo-30757: Improve "How to make stand-alone binaries" FAQ (GH-26309)
Co-authored-by: denfromufa <denfromufa@users.noreply.github.com>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-05-22 23:03:09 +01:00
Irit Katriel 220dd80a26
bpo-33809: add the TracebackException.print() method (GH-24231) 2021-05-22 17:39:33 +01:00
Anthony Sottile 9e746e3298
bpo-20684: Remove unused inspect._signature_get_bound_param (GH-21100) 2021-05-22 15:51:43 +01:00
E-Paine e9f66aedf4
Remove effbot urls (GH-26308) 2021-05-22 14:09:54 +02:00
Dong-hee Na a9e43615c2
Fix typo for configure.ac (GH-26305) 2021-05-22 08:40:59 +09:00
Terry Jan Reedy 604cd71e50
Specify Python Cookbook edition for reference (GH-26301)
The timeit doc references Tim Peters introduction to the Chapter 18,
Algorithms, of the second edition.  The first editiion was before timeit.
The third edition instead has Chapter 1, Data Structures and Algorithms,
without Tim's introduction.
2021-05-21 15:17:10 -07:00
Zackery Spytz 6cc8ac9499
bpo-40736: Improve the error message for re.search() TypeError (GH-23312)
Include the invalid type in the error message.
2021-05-21 22:02:42 +01:00
Pablo Galindo 498383c019
bpo-44032: Fix downcast conversion in frameobject.c (GH-26291) 2021-05-21 19:15:39 +01:00
Mariusz Felisiak b06ed1d883
Remove duplicate words in docs. (GH-26167) 2021-05-21 23:39:09 +05:30
Terry Jan Reedy 2f47d8dcc7
bpo-43927: Change 'IOError' to 'OSError' (GH-26289)
This is the last remaining instance, at least for this chapter, in 3.10 & 3.11.
2021-05-21 13:54:01 -04:00
Pablo Galindo c878a97968
bpo-44180: Fix edge cases in invalid assigment rules in the parser (GH-26283)
The invalid assignment rules are very delicate since the parser can
easily raise an invalid assignment when a keyword argument is provided.
As they are very deep into the grammar tree, is very difficult to
specify in which contexts these rules can be used and in which don't.
For that, we need to use a different version of the rule that doesn't do
error checking in those situations where we don't want the rule to raise
(keyword arguments and generator expressions).

We also need to check if we are in left-recursive rule, as those can try
to eagerly advance the parser even if the parse will fail at the end of
the expression. Failing to do this allows the parser to start parsing a
call as a tuple and incorrectly identify a keyword argument as an
invalid assignment, before it realizes that it was not a tuple after all.
2021-05-21 18:34:54 +01:00
Victor Stinner 615069eb08
bpo-44184: Fix subtype_dealloc() for freed type (GH-26274)
Fix a crash at Python exit when a deallocator function removes the
last strong reference to a heap type.

Don't read type memory after calling basedealloc() since
basedealloc() can deallocate the type and free its memory.

_PyMem_IsPtrFreed() argument is now constant.
2021-05-21 19:19:54 +02:00
Numerlor 642fdfdc04
[doc] Fix indentation in inspect documentation (GH-24846) 2021-05-21 18:05:35 +01:00
Jason R. Coombs 875b3d84b3
bpo-43643: Sync with python/importlib_resources@c17a610aad. (GH-26284)
* bpo-43643: Sync with python/importlib_resources@c17a610aad.
* Sync with python/importlib_resources@89fd5e961a.
2021-05-21 13:00:40 -04:00
Pablo Galindo b51081c1a8
bpo-44180: Report generic syntax errors in the furthest position reached in the first parser pass (GH-26253) 2021-05-21 16:09:51 +01:00
Mark Shannon b11a951f16
bpo-44032: Move data stack to thread from FrameObject. (GH-26076)
* Remove 'zombie' frames. We won't need them once we are allocating fixed-size frames.

* Add co_nlocalplus field to code object to avoid recomputing size of locals + frees + cells.

* Move locals, cells and freevars out of frame object into separate memory buffer.

* Use per-threadstate allocated memory chunks for local variables.

* Move globals and builtins from frame object to per-thread stack.

* Move (slow) locals frame object to per-thread stack.

* Move internal frame functions to internal header.
2021-05-21 10:57:35 +01:00
Raymond Hettinger be4dd7fcd9
bpo-44150: Support optional weights parameter for fmean() (GH-26175) 2021-05-20 20:22:26 -07:00
Barney Gale 18f41c04ff
bpo-38671: Add test that pathlib.Path.resolve() returns an absolute path. (GH-26184)
Issue should be fixed in bpo-43757

Co-Authored-by: Tzu-ping Chung <uranusjr@gmail.com>
2021-05-20 18:41:33 +02:00
Christian Heimes 7109624d45
bpo-38820: Test with OpenSSL 3.0.0-alpha17 (#26266) 2021-05-20 16:46:38 +02:00
native-api 1270ad6ec8
bpo-36160: Fix test_site so that it can run independently of other tests (GH-12131) 2021-05-20 11:25:37 +01:00
Victor Stinner 58a993957a
bpo-44131: Py_FrozenMain() uses PyConfig_SetBytesArgv() (GH-26201)
Moreover, Py_FrozenMain() relies on Py_InitializeFromConfig() to
handle the PYTHONUNBUFFERED environment variable and configure C
stdio streams like stdout (make the stream unbuffered).
2021-05-20 12:08:05 +02:00
Marcono1234 4d396e7d79
Update link in SECURITY.md (GH-21320) 2021-05-19 21:52:25 -04:00
Eric Snow 68307483e5
bpo-43693: Group the code in codeobject.c logically. (gh-26216) 2021-05-19 16:44:56 -06:00
Bruno b66a03a491
[doc] Fix typo in asyncio-eventloop documentation (GH-22311) 2021-05-19 22:18:42 +01:00
naglis c054e8f78f
bpo-40975: [doc] Identify AsyncExitStack.enter_async_context()/aclose() as coroutine methods (GH-20870) 2021-05-19 21:36:05 +01:00
Ken Jin 5c6619552d
bpo-26110: Document CALL_METHOD_KW (GH-26159)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-05-19 19:32:06 +01:00
Pablo Galindo f13a6a2d67
Remove unused function in ceval.c (GH-26246) 2021-05-19 19:12:19 +01:00
Pablo Galindo 95d04710c5
Fix compiler warning for misleading guarding in the tkinter (GH-26244)
The newest gcc emmits this warning:

```
/Modules/_tkinter.c:272:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  272 |         if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate; }
      |         ^~
/Modules/_tkinter.c:2869:5: note: in expansion of macro ‘LEAVE_PYTHON’
 2869 |     LEAVE_PYTHON
      |     ^~~~~~~~~~~~
/Modules/_tkinter.c:243:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  243 |     (*(PyThreadState**)Tcl_GetThreadData(&state_key, sizeof(PyThreadState*)))
      |     ^
/Modules/_tkinter.c:272:57: note: in expansion of macro ‘tcl_tstate’
  272 |         if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate; }
      |                                                         ^~~~~~~~~~
/Modules/_tkinter.c:2869:5: note: in expansion of macro ‘LEAVE_PYTHON’
 2869 |     LEAVE_PYTHON

```

that's because the macro packs together two statements at the same level
as the "if". The warning is misleading but is very noisy so it makes
sense to fix it.
2021-05-19 19:10:23 +01:00
Pablo Galindo be93f81e58
Fix compiler warning in the xml module (GH-26245)
The newest version of gcc complains about passing un-initialized arrays
as constant pointers:

```
/Modules/expat/xmltok_ns.c: In function ‘findEncodingNS’:
/Modules/expat/xmltok.h:272:10: warning: ‘buf’ may be used uninitialized [-Wmaybe-uninitialized]
  272 |   (((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim))
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Modules/expat/xmltok_ns.c:95:3: note: in expansion of macro ‘XmlUtf8Convert’
   95 |   XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1);
      |   ^~~~~~~~~~~~~~
/Modules/expat/xmltok.h:272:10: note: by argument 5 of type ‘const char *’ to ‘enum XML_Convert_Result(const ENCODING *, const char **, const char *, char **, const char *)’ {aka ‘enum XML_Convert_Result(const struct encoding *, const char **, const char *, char **, const char *)’}
  272 |   (((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim))
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Modules/expat/xmltok_ns.c:95:3: note: in expansion of macro ‘XmlUtf8Convert’
   95 |   XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1);
      |   ^~~~~~~~~~~~~~
In file included from /Modules/expat/xmltok.c:1657:
/Modules/expat/xmltok_ns.c:92:8: note: ‘buf’ declared here
   92 |   char buf[ENCODING_MAX];

```
2021-05-19 19:05:40 +01:00
Pablo Galindo 33c0c90dea
bpo-44168: Fix error message in the parser for keyword arguments for invalid expressions (GH-26210) 2021-05-19 19:03:04 +01:00
Hugo van Kemenade 24ccc89547
Enable GitHub Actions on the 3.10 branch (GH-26242) 2021-05-19 16:14:37 +01:00
Catherine Devlin b3ab4344d1
bpo-4928: Document NamedTemporaryFile non-deletion after SIGKILL (#26198)
* bpo-4928 Document NamedTemporaryFile non-deletion after SIGKILL

* 📜🤖 Added by blurb_it.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2021-05-19 10:21:03 -04:00
Ian Norton 5d6e463df4
bpo-43749: Ensure current exe is copied when using venv on windows (GH-25216)
Automerge-Triggered-By: GH:vsajip
2021-05-19 02:37:17 -07:00
Tal Einat 60d343a816
bpo-44010: IDLE: colorize pattern-matching soft keywords (GH-25851) 2021-05-19 12:18:10 +03:00
Erlend Egeberg Aasland d798acc873
bpo-44106: Purge unused sqlite3 doc includes (GH-26234) 2021-05-19 11:08:12 +03:00
Erlend Egeberg Aasland 92d1064727
bpo-44106: Improve sqlite3 example database contents (GH-26027) 2021-05-19 10:41:19 +03:00
Erlend Egeberg Aasland 9014437573
bpo-30593: Doc'ed that executescript() disregards isolation level (GH-26220) 2021-05-19 10:05:48 +03:00
Zackery Spytz 4fdcc39f71
bpo-35765: Clarify references to "object x" in the JSON tutorial (GH-22411) 2021-05-18 14:56:01 -07:00
Jürgen Gmach 02ee819126
bpo-41963: document that ConfigParser strips off comments (GH-26197)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Laura Gutierrez Funderburk <58710704+lgfunderburk@users.noreply.github.com>
2021-05-18 18:11:23 +02:00
uniocto 115dea9e26
bpo-25872: Add unit tests for linecache and threading (GH-25913) 2021-05-18 09:56:52 +01:00
Victor Stinner 834498e178
bpo-44131: Fix Makefile for test_frozenmain (GH-26203)
Remove Programs/test_frozenmain.h Makefile target: it ran make
in parallel which caused build errors on LTO+PGO builds.
2021-05-18 08:40:37 +02:00
Victor Stinner eaede0ded7
bpo-44131: Test Py_FrozenMain() (GH-26126)
* Add test_frozenmain to test_embed
* Add Programs/test_frozenmain.py
* Add Programs/freeze_test_frozenmain.py
* Add Programs/test_frozenmain.h
* Add make regen-test-frozenmain
* Add test_frozenmain command to Programs/_testembed
* _testembed.c: add error(msg) function
2021-05-17 23:48:35 +02:00
Igor Bolshakov f32c7950e0
bpo-43650: Fix MemoryError on zip.read in shutil._unpack_zipfile for large files (GH-25058)
`shutil.unpack_archive()` tries to read the whole file into memory, making no use of any kind of smaller buffer. Process crashes for really large files: I.e. archive: ~1.7G, unpacked: ~10G. Before the crash it can easily take away all available RAM on smaller systems. Had to pull the code form `zipfile.Zipfile.extractall()` to fix this

Automerge-Triggered-By: GH:gpshead
2021-05-17 01:28:21 -07:00
Pete Wicken 83f0f8d62f
bpo-33433 Fix private address checking for IPv4 mapped IPv6. (GH-26172)
For IPv4 mapped IPv6 addresses, defer privacy check to the mapped IPv4 address. Solves bug where public mapped IPv4 addresses are considered private by the IPv6 check.

Automerge-Triggered-By: GH:gpshead
2021-05-17 00:52:36 -07:00
Gregory P. Smith c10392e7dd
bpo-44145: Release the GIL around HMAC_Update. (GH-26157)
It was always meant to be released for parallelization.
This now matches the other similar code in the module.

Thanks michaelforney for noticing!
2021-05-17 00:35:16 -07:00
Sergey B Kirpichev b102dd598d
bpo-44154: optimize Fraction pickling (GH-26186) 2021-05-17 00:20:02 -07:00
Raymond Hettinger b3f65e819f
Apply edits from Allen Downey's review of the linear_regression docs. (GH-26176) 2021-05-16 19:21:14 -07:00
Rafael Fontenelle fdc7e52f5f
[doc] Fix typo in os module (GH-24464)
Automerge-Triggered-By: GH:iritkatriel
2021-05-16 16:38:11 -07:00
Zackery Spytz 56df20d701
Fix a typo/error in a news entry (bidst_wheel -> bdist_wheel) (GH-24284)
This error was fixed recently in `Doc/whatsnew/3.10.rst`.

Automerge-Triggered-By: GH:iritkatriel
2021-05-16 16:34:49 -07:00