Skip to content

Commit f5b0cf7

Browse files
authored
Merge branch 'main' into minidom
2 parents 61baac0 + 5ea9010 commit f5b0cf7

File tree

9 files changed

+159
-117
lines changed

9 files changed

+159
-117
lines changed

.github/workflows/mypy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
- "Lib/_colorize.py"
1212
- "Lib/_pyrepl/**"
1313
- "Lib/test/libregrtest/**"
14+
- "Lib/tomllib/**"
1415
- "Misc/mypy/**"
1516
- "Tools/build/generate_sbom.py"
1617
- "Tools/cases_generator/**"
@@ -44,6 +45,7 @@ jobs:
4445
target: [
4546
"Lib/_pyrepl",
4647
"Lib/test/libregrtest",
48+
"Lib/tomllib",
4749
"Tools/build",
4850
"Tools/cases_generator",
4951
"Tools/clinic",

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ Tools/unicode/data/
143143
/profile-clean-stamp
144144
/profile-run-stamp
145145
/profile-bolt-stamp
146+
/profile-gen-stamp
146147
/pybuilddir.txt
147148
/pyconfig.h
148149
/python-config

Grammar/python.gram

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ _PyPegen_parse(Parser *p)
7979
# ~
8080
# Commit to the current alternative, even if it fails to parse.
8181
# &&e
82-
# Eager parse e. The parser will not backtrack and will immediately
82+
# Eager parse e. The parser will not backtrack and will immediately
8383
# fail with SyntaxError if e cannot be parsed.
8484
#
8585

@@ -659,7 +659,7 @@ type_alias[stmt_ty]:
659659
# Type parameter declaration
660660
# --------------------------
661661

662-
type_params[asdl_type_param_seq*]:
662+
type_params[asdl_type_param_seq*]:
663663
| invalid_type_params
664664
| '[' t=type_param_seq ']' {
665665
CHECK_VERSION(asdl_type_param_seq *, 12, "Type parameter lists are", t) }
@@ -1339,13 +1339,13 @@ invalid_group:
13391339
invalid_import:
13401340
| a='import' ','.dotted_name+ 'from' dotted_name {
13411341
RAISE_SYNTAX_ERROR_STARTING_FROM(a, "Did you mean to use 'from ... import ...' instead?") }
1342-
| 'import' token=NEWLINE {
1342+
| 'import' token=NEWLINE {
13431343
RAISE_SYNTAX_ERROR_STARTING_FROM(token, "Expected one or more names after 'import'") }
13441344

13451345
invalid_import_from_targets:
13461346
| import_from_as_names ',' NEWLINE {
13471347
RAISE_SYNTAX_ERROR("trailing comma not allowed without surrounding parentheses") }
1348-
| token=NEWLINE {
1348+
| token=NEWLINE {
13491349
RAISE_SYNTAX_ERROR_STARTING_FROM(token, "Expected one or more names after 'import'") }
13501350

13511351
invalid_with_stmt:
@@ -1484,5 +1484,5 @@ invalid_factor:
14841484
invalid_type_params:
14851485
| '[' token=']' {
14861486
RAISE_SYNTAX_ERROR_STARTING_FROM(
1487-
token,
1487+
token,
14881488
"Type parameter list cannot be empty")}

Lib/tomllib/_parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def get_or_create_nest(
282282
cont = cont[-1]
283283
if not isinstance(cont, dict):
284284
raise KeyError("There is no nest behind this key")
285-
return cont
285+
return cont # type: ignore[no-any-return]
286286

287287
def append_nest_to_list(self, key: Key) -> None:
288288
cont = self.get_or_create_nest(key[:-1])
@@ -741,7 +741,7 @@ def make_safe_parse_float(parse_float: ParseFloat) -> ParseFloat:
741741
instead of returning illegal types.
742742
"""
743743
# The default `float` callable never returns illegal types. Optimize it.
744-
if parse_float is float: # type: ignore[comparison-overlap]
744+
if parse_float is float:
745745
return float
746746

747747
def safe_parse_float(float_str: str) -> Any:

Lib/tomllib/mypy.ini

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Config file for running mypy on tomllib.
2+
# Run mypy by invoking `mypy --config-file Lib/tomllib/mypy.ini`
3+
# on the command-line from the repo root
4+
5+
[mypy]
6+
files = Lib/tomllib
7+
mypy_path = $MYPY_CONFIG_FILE_DIR/../../Misc/mypy
8+
explicit_package_bases = True
9+
python_version = 3.12
10+
pretty = True
11+
12+
# Enable most stricter settings
13+
enable_error_code = ignore-without-code
14+
strict = True
15+
strict_bytes = True
16+
local_partial_types = True
17+
warn_unreachable = True
18+
# TODO(@sobolevn): remove this setting and refactor any found problems
19+
disallow_any_generics = False

Misc/mypy/tomllib

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../Lib/tomllib

Misc/mypy/typed-stdlib.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22

33
_colorize.py
44
_pyrepl
5+
tomllib

configure

Lines changed: 112 additions & 101 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2985,15 +2985,6 @@ AC_CHECK_HEADERS([ \
29852985
AC_HEADER_DIRENT
29862986
AC_HEADER_MAJOR
29872987

2988-
# for faulthandler
2989-
AC_CHECK_HEADERS([execinfo.h link.h dlfcn.h], [
2990-
AC_CHECK_FUNCS([backtrace dladdr1], [
2991-
# dladdr1 requires -ldl
2992-
ac_cv_require_ldl=yes
2993-
])
2994-
])
2995-
AS_VAR_IF([ac_cv_require_ldl], [yes], [AS_VAR_APPEND([LDFLAGS], [" -ldl"])])
2996-
29972988
# bluetooth/bluetooth.h has been known to not compile with -std=c99.
29982989
# http://permalink.gmane.org/gmane.linux.bluez.kernel/22294
29992990
SAVE_CFLAGS=$CFLAGS
@@ -3715,6 +3706,22 @@ AC_CHECK_LIB([dl], [dlopen]) # Dynamic linking for SunOS/Solaris and SYSV
37153706
AC_CHECK_LIB([dld], [shl_load]) # Dynamic linking for HP-UX
37163707

37173708

3709+
dnl for faulthandler
3710+
AC_CHECK_HEADERS([execinfo.h link.h dlfcn.h], [
3711+
AC_CHECK_FUNCS([backtrace dladdr1], [
3712+
# dladdr1 requires -ldl
3713+
ac_cv_require_ldl=yes
3714+
])
3715+
])
3716+
3717+
dnl only add -ldl to LDFLAGS if it isn't already part of LIBS (GH-133081)
3718+
AS_VAR_IF([ac_cv_require_ldl], [yes], [
3719+
AS_VAR_IF([ac_cv_lib_dl_dlopen], [yes], [], [
3720+
AS_VAR_APPEND([LDFLAGS], [" -ldl"])
3721+
])
3722+
])
3723+
3724+
37183725
dnl check for uuid dependencies
37193726
AH_TEMPLATE([HAVE_UUID_H], [Define to 1 if you have the <uuid.h> header file.])
37203727
AH_TEMPLATE([HAVE_UUID_UUID_H], [Define to 1 if you have the <uuid/uuid.h> header file.])

0 commit comments

Comments
 (0)