Skip to content

Commit 6b7bbc2

Browse files
committed
Merge branch 'main' into sqlite3-cli-completion
2 parents efa93c5 + e7741dd commit 6b7bbc2

File tree

12 files changed

+95
-69
lines changed

12 files changed

+95
-69
lines changed

Doc/using/windows.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ When you first install a runtime, you will likely be prompted to add a directory
9191
to your :envvar:`PATH`. This is optional, if you prefer to use the ``py``
9292
command, but is offered for those who prefer the full range of aliases (such
9393
as ``python3.14.exe``) to be available. The directory will be
94-
:file:`%LocalAppData%\Python\bin` by default, but may be customized by an
94+
:file:`%LocalAppData%\\Python\\bin` by default, but may be customized by an
9595
administrator. Click Start and search for "Edit environment variables for your
9696
account" for the system settings page to add the path.
9797

Doc/whatsnew/3.14.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ and improvements in user-friendliness and correctness.
8888
* :ref:`PEP 758: Allow except and except* expressions without parentheses <whatsnew314-pep758>`
8989
* :ref:`PEP 761: Discontinuation of PGP signatures <whatsnew314-pep761>`
9090
* :ref:`PEP 765: Disallow return/break/continue that exit a finally block <whatsnew314-pep765>`
91+
* :ref:`Free-threaded mode improvements <whatsnew314-free-threaded-cpython>`
9192
* :ref:`PEP 768: Safe external debugger interface for CPython <whatsnew314-pep768>`
9293
* :ref:`PEP 784: Adding Zstandard to the standard library <whatsnew314-pep784>`
9394
* :ref:`A new type of interpreter <whatsnew314-tail-call>`
@@ -772,6 +773,27 @@ For further information on how to build Python, see
772773
(Contributed by Ken Jin in :gh:`128563`, with ideas on how to implement this
773774
in CPython by Mark Shannon, Garrett Gu, Haoran Xu, and Josh Haberman.)
774775

776+
.. _whatsnew314-free-threaded-cpython:
777+
778+
Free-threaded mode
779+
------------------
780+
781+
Free-threaded mode (:pep:`703`), initially added in 3.13, has been significantly improved.
782+
The implementation described in PEP 703 was finished, including C API changes,
783+
and temporary workarounds in the interpreter were replaced with more permanent solutions.
784+
The specializing adaptive interpreter (:pep:`659`) is now enabled in free-threaded mode,
785+
which along with many other optimizations greatly improves its performance.
786+
The performance penalty on single-threaded code in free-threaded mode is now roughly 5-10%,
787+
depending on platform and C compiler used.
788+
789+
This work was done by many contributors: Sam Gross, Matt Page, Neil Schemenauer,
790+
Thomas Wouters, Donghee Na, Kirill Podoprigora, Ken Jin, Itamar Oren,
791+
Brett Simmers, Dino Viehland, Nathan Goldbaum, Ralf Gommers, Lysandros Nikolaou,
792+
Kumar Aditya, Edgar Margffoy, and many others.
793+
794+
Some of these contributors are employed by Meta, which has continued to provide
795+
significant engineering resources to support this project.
796+
775797

776798
.. _whatsnew314-pyrepl-highlighting:
777799

Doc/whatsnew/3.15.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ sqlite3
8080
Other language changes
8181
======================
8282

83+
* Several error messages incorrectly using the term "argument" have been corrected.
84+
(Contributed by Stan Ulbrych in :gh:`133382`.)
85+
8386

8487

8588
New modules

Grammar/python.gram

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,7 @@ invalid_dict_comprehension:
13051305
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "dict unpacking cannot be used in dict comprehension") }
13061306
invalid_parameters:
13071307
| a="/" ',' {
1308-
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "at least one argument must precede /") }
1308+
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "at least one parameter must precede /") }
13091309
| (slash_no_default | slash_with_default) param_maybe_default* a='/' {
13101310
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "/ may appear only once") }
13111311
| slash_no_default? param_no_default* invalid_parameters_helper a=param_no_default {
@@ -1319,21 +1319,21 @@ invalid_parameters:
13191319
invalid_default:
13201320
| a='=' &(')'|',') { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "expected default value expression") }
13211321
invalid_star_etc:
1322-
| a='*' (')' | ',' (')' | '**')) { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "named arguments must follow bare *") }
1322+
| a='*' (')' | ',' (')' | '**')) { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "named parameters must follow bare *") }
13231323
| '*' ',' TYPE_COMMENT { RAISE_SYNTAX_ERROR("bare * has associated type comment") }
1324-
| '*' param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "var-positional argument cannot have default value") }
1324+
| '*' param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "var-positional parameter cannot have default value") }
13251325
| '*' (param_no_default | ',') param_maybe_default* a='*' (param_no_default | ',') {
1326-
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "* argument may appear only once") }
1326+
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "* may appear only once") }
13271327
invalid_kwds:
1328-
| '**' param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "var-keyword argument cannot have default value") }
1329-
| '**' param ',' a=param { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "arguments cannot follow var-keyword argument") }
1330-
| '**' param ',' a[Token*]=('*'|'**'|'/') { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "arguments cannot follow var-keyword argument") }
1328+
| '**' param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "var-keyword parameter cannot have default value") }
1329+
| '**' param ',' a=param { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "parameters cannot follow var-keyword parameter") }
1330+
| '**' param ',' a[Token*]=('*'|'**'|'/') { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "parameters cannot follow var-keyword parameter") }
13311331
invalid_parameters_helper: # This is only there to avoid type errors
13321332
| a=slash_with_default { _PyPegen_singleton_seq(p, a) }
13331333
| param_with_default+
13341334
invalid_lambda_parameters:
13351335
| a="/" ',' {
1336-
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "at least one argument must precede /") }
1336+
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "at least one parameter must precede /") }
13371337
| (lambda_slash_no_default | lambda_slash_with_default) lambda_param_maybe_default* a='/' {
13381338
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "/ may appear only once") }
13391339
| lambda_slash_no_default? lambda_param_no_default* invalid_lambda_parameters_helper a=lambda_param_no_default {
@@ -1348,14 +1348,14 @@ invalid_lambda_parameters_helper:
13481348
| a=lambda_slash_with_default { _PyPegen_singleton_seq(p, a) }
13491349
| lambda_param_with_default+
13501350
invalid_lambda_star_etc:
1351-
| '*' (':' | ',' (':' | '**')) { RAISE_SYNTAX_ERROR("named arguments must follow bare *") }
1352-
| '*' lambda_param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "var-positional argument cannot have default value") }
1351+
| '*' (':' | ',' (':' | '**')) { RAISE_SYNTAX_ERROR("named parameters must follow bare *") }
1352+
| '*' lambda_param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "var-positional parameter cannot have default value") }
13531353
| '*' (lambda_param_no_default | ',') lambda_param_maybe_default* a='*' (lambda_param_no_default | ',') {
1354-
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "* argument may appear only once") }
1354+
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "* may appear only once") }
13551355
invalid_lambda_kwds:
1356-
| '**' lambda_param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "var-keyword argument cannot have default value") }
1357-
| '**' lambda_param ',' a=lambda_param { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "arguments cannot follow var-keyword argument") }
1358-
| '**' lambda_param ',' a[Token*]=('*'|'**'|'/') { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "arguments cannot follow var-keyword argument") }
1356+
| '**' lambda_param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "var-keyword parameter cannot have default value") }
1357+
| '**' lambda_param ',' a=lambda_param { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "parameters cannot follow var-keyword parameter") }
1358+
| '**' lambda_param ',' a[Token*]=('*'|'**'|'/') { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "parameters cannot follow var-keyword parameter") }
13591359
invalid_double_type_comments:
13601360
| TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT {
13611361
RAISE_SYNTAX_ERROR("Cannot have two type comments on def") }

Lib/test/test_codeop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def test_syntax_errors(self):
322322
dedent("""\
323323
def foo(x,x):
324324
pass
325-
"""), "duplicate argument 'x' in function definition")
325+
"""), "duplicate parameter 'x' in function definition")
326326

327327

328328

Lib/test/test_positional_only_arg.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ def test_invalid_syntax_errors(self):
3737
check_syntax_error(self, "def f(/): pass")
3838
check_syntax_error(self, "def f(*, a, /): pass")
3939
check_syntax_error(self, "def f(*, /, a): pass")
40-
check_syntax_error(self, "def f(a, /, a): pass", "duplicate argument 'a' in function definition")
41-
check_syntax_error(self, "def f(a, /, *, a): pass", "duplicate argument 'a' in function definition")
40+
check_syntax_error(self, "def f(a, /, a): pass", "duplicate parameter 'a' in function definition")
41+
check_syntax_error(self, "def f(a, /, *, a): pass", "duplicate parameter 'a' in function definition")
4242
check_syntax_error(self, "def f(a, b/2, c): pass")
4343
check_syntax_error(self, "def f(a, /, c, /): pass")
4444
check_syntax_error(self, "def f(a, /, c, /, d): pass")
@@ -59,8 +59,8 @@ def test_invalid_syntax_errors_async(self):
5959
check_syntax_error(self, "async def f(/): pass")
6060
check_syntax_error(self, "async def f(*, a, /): pass")
6161
check_syntax_error(self, "async def f(*, /, a): pass")
62-
check_syntax_error(self, "async def f(a, /, a): pass", "duplicate argument 'a' in function definition")
63-
check_syntax_error(self, "async def f(a, /, *, a): pass", "duplicate argument 'a' in function definition")
62+
check_syntax_error(self, "async def f(a, /, a): pass", "duplicate parameter 'a' in function definition")
63+
check_syntax_error(self, "async def f(a, /, *, a): pass", "duplicate parameter 'a' in function definition")
6464
check_syntax_error(self, "async def f(a, b/2, c): pass")
6565
check_syntax_error(self, "async def f(a, /, c, /): pass")
6666
check_syntax_error(self, "async def f(a, /, c, /, d): pass")
@@ -247,8 +247,8 @@ def test_invalid_syntax_lambda(self):
247247
check_syntax_error(self, "lambda /: None")
248248
check_syntax_error(self, "lambda *, a, /: None")
249249
check_syntax_error(self, "lambda *, /, a: None")
250-
check_syntax_error(self, "lambda a, /, a: None", "duplicate argument 'a' in function definition")
251-
check_syntax_error(self, "lambda a, /, *, a: None", "duplicate argument 'a' in function definition")
250+
check_syntax_error(self, "lambda a, /, a: None", "duplicate parameter 'a' in function definition")
251+
check_syntax_error(self, "lambda a, /, *, a: None", "duplicate parameter 'a' in function definition")
252252
check_syntax_error(self, "lambda a, /, b, /: None")
253253
check_syntax_error(self, "lambda a, /, b, /, c: None")
254254
check_syntax_error(self, "lambda a, /, b, /, c, *, d: None")

Lib/test/test_pyrepl/test_interact.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def test_runsource_show_syntax_error_location(self):
113113
r = """
114114
def f(x, x): ...
115115
^
116-
SyntaxError: duplicate argument 'x' in function definition"""
116+
SyntaxError: duplicate parameter 'x' in function definition"""
117117
self.assertIn(r, f.getvalue())
118118

119119
def test_runsource_shows_syntax_error_for_failed_compilation(self):

Lib/test/test_repl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def test_runsource_show_syntax_error_location(self):
197197
expected_lines = [
198198
' def f(x, x): ...',
199199
' ^',
200-
"SyntaxError: duplicate argument 'x' in function definition"
200+
"SyntaxError: duplicate parameter 'x' in function definition"
201201
]
202202
self.assertEqual(output.splitlines()[4:-1], expected_lines)
203203

Lib/test/test_syntax.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@
419419
>>> def foo(/,a,b=,c):
420420
... pass
421421
Traceback (most recent call last):
422-
SyntaxError: at least one argument must precede /
422+
SyntaxError: at least one parameter must precede /
423423
424424
>>> def foo(a,/,/,b,c):
425425
... pass
@@ -454,67 +454,67 @@
454454
>>> def foo(a,*b=3,c):
455455
... pass
456456
Traceback (most recent call last):
457-
SyntaxError: var-positional argument cannot have default value
457+
SyntaxError: var-positional parameter cannot have default value
458458
459459
>>> def foo(a,*b: int=,c):
460460
... pass
461461
Traceback (most recent call last):
462-
SyntaxError: var-positional argument cannot have default value
462+
SyntaxError: var-positional parameter cannot have default value
463463
464464
>>> def foo(a,**b=3):
465465
... pass
466466
Traceback (most recent call last):
467-
SyntaxError: var-keyword argument cannot have default value
467+
SyntaxError: var-keyword parameter cannot have default value
468468
469469
>>> def foo(a,**b: int=3):
470470
... pass
471471
Traceback (most recent call last):
472-
SyntaxError: var-keyword argument cannot have default value
472+
SyntaxError: var-keyword parameter cannot have default value
473473
474474
>>> def foo(a,*a, b, **c, d):
475475
... pass
476476
Traceback (most recent call last):
477-
SyntaxError: arguments cannot follow var-keyword argument
477+
SyntaxError: parameters cannot follow var-keyword parameter
478478
479479
>>> def foo(a,*a, b, **c, d=4):
480480
... pass
481481
Traceback (most recent call last):
482-
SyntaxError: arguments cannot follow var-keyword argument
482+
SyntaxError: parameters cannot follow var-keyword parameter
483483
484484
>>> def foo(a,*a, b, **c, *d):
485485
... pass
486486
Traceback (most recent call last):
487-
SyntaxError: arguments cannot follow var-keyword argument
487+
SyntaxError: parameters cannot follow var-keyword parameter
488488
489489
>>> def foo(a,*a, b, **c, **d):
490490
... pass
491491
Traceback (most recent call last):
492-
SyntaxError: arguments cannot follow var-keyword argument
492+
SyntaxError: parameters cannot follow var-keyword parameter
493493
494494
>>> def foo(a=1,/,**b,/,c):
495495
... pass
496496
Traceback (most recent call last):
497-
SyntaxError: arguments cannot follow var-keyword argument
497+
SyntaxError: parameters cannot follow var-keyword parameter
498498
499499
>>> def foo(*b,*d):
500500
... pass
501501
Traceback (most recent call last):
502-
SyntaxError: * argument may appear only once
502+
SyntaxError: * may appear only once
503503
504504
>>> def foo(a,*b,c,*d,*e,c):
505505
... pass
506506
Traceback (most recent call last):
507-
SyntaxError: * argument may appear only once
507+
SyntaxError: * may appear only once
508508
509509
>>> def foo(a,b,/,c,*b,c,*d,*e,c):
510510
... pass
511511
Traceback (most recent call last):
512-
SyntaxError: * argument may appear only once
512+
SyntaxError: * may appear only once
513513
514514
>>> def foo(a,b,/,c,*b,c,*d,**e):
515515
... pass
516516
Traceback (most recent call last):
517-
SyntaxError: * argument may appear only once
517+
SyntaxError: * may appear only once
518518
519519
>>> def foo(a=1,/*,b,c):
520520
... pass
@@ -538,7 +538,7 @@
538538
539539
>>> lambda /,a,b,c: None
540540
Traceback (most recent call last):
541-
SyntaxError: at least one argument must precede /
541+
SyntaxError: at least one parameter must precede /
542542
543543
>>> lambda a,/,/,b,c: None
544544
Traceback (most recent call last):
@@ -570,47 +570,47 @@
570570
571571
>>> lambda a,*b=3,c: None
572572
Traceback (most recent call last):
573-
SyntaxError: var-positional argument cannot have default value
573+
SyntaxError: var-positional parameter cannot have default value
574574
575575
>>> lambda a,**b=3: None
576576
Traceback (most recent call last):
577-
SyntaxError: var-keyword argument cannot have default value
577+
SyntaxError: var-keyword parameter cannot have default value
578578
579579
>>> lambda a, *a, b, **c, d: None
580580
Traceback (most recent call last):
581-
SyntaxError: arguments cannot follow var-keyword argument
581+
SyntaxError: parameters cannot follow var-keyword parameter
582582
583583
>>> lambda a,*a, b, **c, d=4: None
584584
Traceback (most recent call last):
585-
SyntaxError: arguments cannot follow var-keyword argument
585+
SyntaxError: parameters cannot follow var-keyword parameter
586586
587587
>>> lambda a,*a, b, **c, *d: None
588588
Traceback (most recent call last):
589-
SyntaxError: arguments cannot follow var-keyword argument
589+
SyntaxError: parameters cannot follow var-keyword parameter
590590
591591
>>> lambda a,*a, b, **c, **d: None
592592
Traceback (most recent call last):
593-
SyntaxError: arguments cannot follow var-keyword argument
593+
SyntaxError: parameters cannot follow var-keyword parameter
594594
595595
>>> lambda a=1,/,**b,/,c: None
596596
Traceback (most recent call last):
597-
SyntaxError: arguments cannot follow var-keyword argument
597+
SyntaxError: parameters cannot follow var-keyword parameter
598598
599599
>>> lambda *b,*d: None
600600
Traceback (most recent call last):
601-
SyntaxError: * argument may appear only once
601+
SyntaxError: * may appear only once
602602
603603
>>> lambda a,*b,c,*d,*e,c: None
604604
Traceback (most recent call last):
605-
SyntaxError: * argument may appear only once
605+
SyntaxError: * may appear only once
606606
607607
>>> lambda a,b,/,c,*b,c,*d,*e,c: None
608608
Traceback (most recent call last):
609-
SyntaxError: * argument may appear only once
609+
SyntaxError: * may appear only once
610610
611611
>>> lambda a,b,/,c,*b,c,*d,**e: None
612612
Traceback (most recent call last):
613-
SyntaxError: * argument may appear only once
613+
SyntaxError: * may appear only once
614614
615615
>>> lambda a=1,d=,c: None
616616
Traceback (most recent call last):
@@ -1304,7 +1304,7 @@
13041304
Traceback (most recent call last):
13051305
SyntaxError: expected '('
13061306
1307-
Parenthesized arguments in function definitions
1307+
Parenthesized parameters in function definitions
13081308
13091309
>>> def f(x, (y, z), w):
13101310
... pass
@@ -2178,7 +2178,7 @@
21782178
21792179
>>> with (lambda *:0): pass
21802180
Traceback (most recent call last):
2181-
SyntaxError: named arguments must follow bare *
2181+
SyntaxError: named parameters must follow bare *
21822182
21832183
Corner-cases that used to crash:
21842184
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Correct usage of *arguments* in error messages.

0 commit comments

Comments
 (0)