-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #147 from danthedeckie/catch-warnings
Catch warnings
- Loading branch information
Showing
3 changed files
with
20 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,7 @@ | |
- koenigsley (Mikhail Yeremeyev) documentation typos correction. | ||
- kurtmckee (Kurt McKee) Infrastructure updates | ||
- edgarrmondragon (Edgar Ramírez-Mondragón) Address Python 3.12+ deprecation warnings | ||
- cedk (Cédric Krier) <[email protected]> Allow running tests with Werror | ||
------------------------------------- | ||
Basic Usage: | ||
|
@@ -370,16 +371,18 @@ def __init__(self, operators=None, functions=None, names=None): | |
ast.Constant: self._eval_constant, | ||
} | ||
|
||
# py3.12 deprecated ast.Num, ast.Str, ast.NameConstant | ||
# https://docs.python.org/3.12/whatsnew/3.12.html#deprecated | ||
if Num := getattr(ast, "Num"): | ||
self.nodes[Num] = self._eval_num | ||
with warnings.catch_warnings(): | ||
warnings.simplefilter("ignore") | ||
# py3.12 deprecated ast.Num, ast.Str, ast.NameConstant | ||
# https://docs.python.org/3.12/whatsnew/3.12.html#deprecated | ||
if Num := getattr(ast, "Num"): | ||
self.nodes[Num] = self._eval_num | ||
|
||
if Str := getattr(ast, "Str"): | ||
self.nodes[Str] = self._eval_str | ||
if Str := getattr(ast, "Str"): | ||
self.nodes[Str] = self._eval_str | ||
|
||
if NameConstant := getattr(ast, "NameConstant"): | ||
self.nodes[NameConstant] = self._eval_constant | ||
if NameConstant := getattr(ast, "NameConstant"): | ||
self.nodes[NameConstant] = self._eval_constant | ||
|
||
# Defaults: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters