From webhook-mailer at python.org Tue Aug 1 00:24:20 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Tue, 01 Aug 2017 04:24:20 -0000 Subject: [Python-checkins] bpo-31083: IDLE: Describe the Page classes in configdialog (#2965) Message-ID: https://github.com/python/cpython/commit/6f446bee4f6ac0c61bb2c3386a0149fd36855793 commit: 6f446bee4f6ac0c61bb2c3386a0149fd36855793 branch: master author: csabella committer: Terry Jan Reedy date: 2017-08-01T00:24:07-04:00 summary: bpo-31083: IDLE: Describe the Page classes in configdialog (#2965) Add template as comment. Update existing classes to match outline. Initial patch by Cheryl Sabella. files: A Misc/NEWS.d/next/IDLE/2017-07-31-23-20-51.bpo-31083.991FXm.rst M Lib/idlelib/configdialog.py diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py index 28070a51709..6d8a03b1c00 100644 --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -1382,11 +1382,27 @@ def save_all_changed_extensions(self): self.ext_userCfg.Save() +# class TabPage(Frame): # A template for Page classes. +# def __init__(self, master): +# super().__init__(master) +# self.create_page_tab() +# self.load_tab_cfg() +# def create_page_tab(self): +# # Define tk vars and register var and callback with tracers. +# # Create subframes and widgets. +# # Pack widgets. +# def load_tab_cfg(self): +# # Initialize widgets with data from idleConf. +# def var_changed_var_name(): +# # For each tk var that needs other than default callback. +# def other_methods(): +# # Define tab-specific behavior. + + class FontPage(Frame): - def __init__(self, parent, highpage): - super().__init__(parent) - self.parent = parent + def __init__(self, master, highpage): + super().__init__(master) self.highlight_sample = highpage.highlight_sample self.create_page_font_tab() self.load_font_cfg() @@ -1439,19 +1455,17 @@ def create_page_font_tab(self): indent_title: Label (*)indent_scale: Scale - space_num """ - parent = self.parent - self.font_name = tracers.add(StringVar(parent), self.var_changed_font) - self.font_size = tracers.add(StringVar(parent), self.var_changed_font) - self.font_bold = tracers.add(BooleanVar(parent), self.var_changed_font) + self.font_name = tracers.add(StringVar(self), self.var_changed_font) + self.font_size = tracers.add(StringVar(self), self.var_changed_font) + self.font_bold = tracers.add(BooleanVar(self), self.var_changed_font) self.space_num = tracers.add(IntVar(self), ('main', 'Indent', 'num-spaces')) # Create widgets: # body and body section frames. - frame = self frame_font = LabelFrame( - frame, borderwidth=2, relief=GROOVE, text=' Base Editor Font ') + self, borderwidth=2, relief=GROOVE, text=' Base Editor Font ') frame_indent = LabelFrame( - frame, borderwidth=2, relief=GROOVE, text=' Indentation Width ') + self, borderwidth=2, relief=GROOVE, text=' Indentation Width ') # frame_font. frame_font_name = Frame(frame_font) frame_font_param = Frame(frame_font) @@ -1471,7 +1485,7 @@ def create_page_font_tab(self): frame_font_param, variable=self.font_bold, onvalue=1, offvalue=0, text='Bold') frame_font_sample = Frame(frame_font, relief=SOLID, borderwidth=1) - temp_font = tkFont.Font(parent, ('courier', 10, 'normal')) + temp_font = tkFont.Font(self, ('courier', 10, 'normal')) self.font_sample = Label( frame_font_sample, justify=LEFT, font=temp_font, text='AaBbCcDdEe\nFfGgHhIiJj\n1234567890\n#:+=(){}[]') @@ -1503,8 +1517,6 @@ def create_page_font_tab(self): indent_title.pack(side=TOP, anchor=W, padx=5) self.indent_scale.pack(side=TOP, padx=5, fill=X) - return frame - def load_font_cfg(self): """Load current configuration settings for the font options. @@ -1597,8 +1609,8 @@ def var_changed_space_num(self, *params): class GenPage(Frame): - def __init__(self, parent): - super().__init__(parent) + def __init__(self, master): + super().__init__(master) self.create_page_general() self.load_general_cfg() diff --git a/Misc/NEWS.d/next/IDLE/2017-07-31-23-20-51.bpo-31083.991FXm.rst b/Misc/NEWS.d/next/IDLE/2017-07-31-23-20-51.bpo-31083.991FXm.rst new file mode 100644 index 00000000000..3bb337562de --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-07-31-23-20-51.bpo-31083.991FXm.rst @@ -0,0 +1,3 @@ +IDLE - Add an outline of a TabPage class in configdialog. +Update existing classes to match outline. +Initial patch by Cheryl Sabella. From webhook-mailer at python.org Tue Aug 1 00:34:39 2017 From: webhook-mailer at python.org (Mariatta) Date: Tue, 01 Aug 2017 04:34:39 -0000 Subject: [Python-checkins] Remove .mention-bot (GH-2923) (GH-2970) Message-ID: https://github.com/python/cpython/commit/f9463b8cc9e2906d3f457d59286665bee08f626f commit: f9463b8cc9e2906d3f457d59286665bee08f626f branch: 3.6 author: Mariatta committer: GitHub date: 2017-07-31T21:34:36-07:00 summary: Remove .mention-bot (GH-2923) (GH-2970) (cherry picked from commit e1e60bd95c376f9b18cbaf9481364281c6cc1bc7) files: D .mention-bot diff --git a/.mention-bot b/.mention-bot deleted file mode 100644 index cb53b993fb1..00000000000 --- a/.mention-bot +++ /dev/null @@ -1,3 +0,0 @@ -{ - "findPotentialReviewers": false -} From webhook-mailer at python.org Tue Aug 1 00:34:50 2017 From: webhook-mailer at python.org (Mariatta) Date: Tue, 01 Aug 2017 04:34:50 -0000 Subject: [Python-checkins] Remove .mention-bot (GH-2923) (GH-2971) Message-ID: https://github.com/python/cpython/commit/27ea3c782f0cc67805a3486336ce71f3ae08ba8a commit: 27ea3c782f0cc67805a3486336ce71f3ae08ba8a branch: 3.5 author: Mariatta committer: GitHub date: 2017-07-31T21:34:47-07:00 summary: Remove .mention-bot (GH-2923) (GH-2971) (cherry picked from commit e1e60bd95c376f9b18cbaf9481364281c6cc1bc7) files: D .mention-bot diff --git a/.mention-bot b/.mention-bot deleted file mode 100644 index cb53b993fb1..00000000000 --- a/.mention-bot +++ /dev/null @@ -1,3 +0,0 @@ -{ - "findPotentialReviewers": false -} From webhook-mailer at python.org Tue Aug 1 00:35:01 2017 From: webhook-mailer at python.org (Mariatta) Date: Tue, 01 Aug 2017 04:35:01 -0000 Subject: [Python-checkins] Remove .mention-bot (GH-2923) (GH-2972) Message-ID: https://github.com/python/cpython/commit/956902e5bc4b41fda79c6c1018c97355639cb245 commit: 956902e5bc4b41fda79c6c1018c97355639cb245 branch: 2.7 author: Mariatta committer: GitHub date: 2017-07-31T21:34:58-07:00 summary: Remove .mention-bot (GH-2923) (GH-2972) (cherry picked from commit e1e60bd95c376f9b18cbaf9481364281c6cc1bc7) files: D .mention-bot diff --git a/.mention-bot b/.mention-bot deleted file mode 100644 index cb53b993fb1..00000000000 --- a/.mention-bot +++ /dev/null @@ -1,3 +0,0 @@ -{ - "findPotentialReviewers": false -} From webhook-mailer at python.org Tue Aug 1 01:00:38 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Tue, 01 Aug 2017 05:00:38 -0000 Subject: [Python-checkins] [3.6] bpo-31083: IDLE: Describe the Page classes in configdialog (GH-2965) (#2973) Message-ID: https://github.com/python/cpython/commit/48fcc72c83e1b47b200dd39f9dcc9f62fa0d4d17 commit: 48fcc72c83e1b47b200dd39f9dcc9f62fa0d4d17 branch: 3.6 author: Terry Jan Reedy committer: GitHub date: 2017-08-01T01:00:33-04:00 summary: [3.6] bpo-31083: IDLE: Describe the Page classes in configdialog (GH-2965) (#2973) Add template as comment. Update existing classes to match outline. Initial patch by Cheryl Sabella. (cherry picked from commit 6f446be) files: A Misc/NEWS.d/next/IDLE/2017-07-31-23-20-51.bpo-31083.991FXm.rst M Lib/idlelib/configdialog.py diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py index 28070a51709..6d8a03b1c00 100644 --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -1382,11 +1382,27 @@ def save_all_changed_extensions(self): self.ext_userCfg.Save() +# class TabPage(Frame): # A template for Page classes. +# def __init__(self, master): +# super().__init__(master) +# self.create_page_tab() +# self.load_tab_cfg() +# def create_page_tab(self): +# # Define tk vars and register var and callback with tracers. +# # Create subframes and widgets. +# # Pack widgets. +# def load_tab_cfg(self): +# # Initialize widgets with data from idleConf. +# def var_changed_var_name(): +# # For each tk var that needs other than default callback. +# def other_methods(): +# # Define tab-specific behavior. + + class FontPage(Frame): - def __init__(self, parent, highpage): - super().__init__(parent) - self.parent = parent + def __init__(self, master, highpage): + super().__init__(master) self.highlight_sample = highpage.highlight_sample self.create_page_font_tab() self.load_font_cfg() @@ -1439,19 +1455,17 @@ def create_page_font_tab(self): indent_title: Label (*)indent_scale: Scale - space_num """ - parent = self.parent - self.font_name = tracers.add(StringVar(parent), self.var_changed_font) - self.font_size = tracers.add(StringVar(parent), self.var_changed_font) - self.font_bold = tracers.add(BooleanVar(parent), self.var_changed_font) + self.font_name = tracers.add(StringVar(self), self.var_changed_font) + self.font_size = tracers.add(StringVar(self), self.var_changed_font) + self.font_bold = tracers.add(BooleanVar(self), self.var_changed_font) self.space_num = tracers.add(IntVar(self), ('main', 'Indent', 'num-spaces')) # Create widgets: # body and body section frames. - frame = self frame_font = LabelFrame( - frame, borderwidth=2, relief=GROOVE, text=' Base Editor Font ') + self, borderwidth=2, relief=GROOVE, text=' Base Editor Font ') frame_indent = LabelFrame( - frame, borderwidth=2, relief=GROOVE, text=' Indentation Width ') + self, borderwidth=2, relief=GROOVE, text=' Indentation Width ') # frame_font. frame_font_name = Frame(frame_font) frame_font_param = Frame(frame_font) @@ -1471,7 +1485,7 @@ def create_page_font_tab(self): frame_font_param, variable=self.font_bold, onvalue=1, offvalue=0, text='Bold') frame_font_sample = Frame(frame_font, relief=SOLID, borderwidth=1) - temp_font = tkFont.Font(parent, ('courier', 10, 'normal')) + temp_font = tkFont.Font(self, ('courier', 10, 'normal')) self.font_sample = Label( frame_font_sample, justify=LEFT, font=temp_font, text='AaBbCcDdEe\nFfGgHhIiJj\n1234567890\n#:+=(){}[]') @@ -1503,8 +1517,6 @@ def create_page_font_tab(self): indent_title.pack(side=TOP, anchor=W, padx=5) self.indent_scale.pack(side=TOP, padx=5, fill=X) - return frame - def load_font_cfg(self): """Load current configuration settings for the font options. @@ -1597,8 +1609,8 @@ def var_changed_space_num(self, *params): class GenPage(Frame): - def __init__(self, parent): - super().__init__(parent) + def __init__(self, master): + super().__init__(master) self.create_page_general() self.load_general_cfg() diff --git a/Misc/NEWS.d/next/IDLE/2017-07-31-23-20-51.bpo-31083.991FXm.rst b/Misc/NEWS.d/next/IDLE/2017-07-31-23-20-51.bpo-31083.991FXm.rst new file mode 100644 index 00000000000..3bb337562de --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-07-31-23-20-51.bpo-31083.991FXm.rst @@ -0,0 +1,3 @@ +IDLE - Add an outline of a TabPage class in configdialog. +Update existing classes to match outline. +Initial patch by Cheryl Sabella. From solipsis at pitrou.net Tue Aug 1 05:10:09 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 01 Aug 2017 09:10:09 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=5 Message-ID: <20170801091009.15106.8A4A6A68C6EDBFD2@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [7, -7, 1] memory blocks, sum=1 test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogapBbQ7', '--timeout', '7200'] From webhook-mailer at python.org Tue Aug 1 14:12:30 2017 From: webhook-mailer at python.org (Vinay Sajip) Date: Tue, 01 Aug 2017 18:12:30 -0000 Subject: [Python-checkins] bpo-31084: QueueHandler now formats messages correctly. (GH-2954) Message-ID: https://github.com/python/cpython/commit/adfe3440f65dfd6cf4463db6cd02cdc78e77ce17 commit: adfe3440f65dfd6cf4463db6cd02cdc78e77ce17 branch: master author: favll committer: Vinay Sajip date: 2017-08-01T19:12:26+01:00 summary: bpo-31084: QueueHandler now formats messages correctly. (GH-2954) files: M Lib/logging/handlers.py M Lib/test/test_logging.py diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index 2f934b33071..b5fdfbc6839 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -1372,13 +1372,14 @@ def prepare(self, record): of the record while leaving the original intact. """ # The format operation gets traceback text into record.exc_text - # (if there's exception data), and also puts the message into - # record.message. We can then use this to replace the original + # (if there's exception data), and also returns the formatted + # message. We can then use this to replace the original # msg + args, as these might be unpickleable. We also zap the # exc_info attribute, as it's no longer needed and, if not None, # will typically not be pickleable. - self.format(record) - record.msg = record.message + msg = self.format(record) + record.message = msg + record.msg = msg record.args = None record.exc_info = None return record diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 6d0b23441ba..36ea0725153 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -3126,6 +3126,7 @@ def setUp(self): BaseTest.setUp(self) self.queue = queue.Queue(-1) self.que_hdlr = logging.handlers.QueueHandler(self.queue) + self.name = 'que' self.que_logger = logging.getLogger('que') self.que_logger.propagate = False self.que_logger.setLevel(logging.WARNING) @@ -3147,6 +3148,19 @@ def test_queue_handler(self): self.assertEqual(data.name, self.que_logger.name) self.assertEqual((data.msg, data.args), (msg, None)) + def test_formatting(self): + msg = self.next_message() + levelname = logging.getLevelName(logging.WARNING) + log_format_str = '{name} -> {levelname}: {message}' + formatted_msg = log_format_str.format(name=self.name, + levelname=levelname, message=msg) + formatter = logging.Formatter(self.log_format) + self.que_hdlr.setFormatter(formatter) + self.que_logger.warning(msg) + log_record = self.queue.get_nowait() + self.assertEqual(formatted_msg, log_record.msg) + self.assertEqual(formatted_msg, log_record.message) + @unittest.skipUnless(hasattr(logging.handlers, 'QueueListener'), 'logging.handlers.QueueListener required for this test') def test_queue_listener(self): From webhook-mailer at python.org Tue Aug 1 17:51:20 2017 From: webhook-mailer at python.org (Brett Cannon) Date: Tue, 01 Aug 2017 21:51:20 -0000 Subject: [Python-checkins] List myself as interested in all import-related pull requests (GH-2976) Message-ID: https://github.com/python/cpython/commit/9eef9e805e950eb6bc9ded8c99c5d6abf1d681de commit: 9eef9e805e950eb6bc9ded8c99c5d6abf1d681de branch: master author: Brett Cannon committer: GitHub date: 2017-08-01T14:51:17-07:00 summary: List myself as interested in all import-related pull requests (GH-2976) files: M .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d1ebf2c2bac..1dc79f7dec6 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -8,5 +8,8 @@ **/*hashlib* @tiran **/*pyhash* @tiran +# Import (including importlib) +**/*import* @brettcannon + # SSL **/*ssl* @tiran From webhook-mailer at python.org Tue Aug 1 18:35:50 2017 From: webhook-mailer at python.org (=?utf-8?q?=C5=81ukasz?= Langa) Date: Tue, 01 Aug 2017 22:35:50 -0000 Subject: [Python-checkins] bpo-30897: Add is_mount() to pathlib.Path (#2669) Message-ID: https://github.com/python/cpython/commit/173ff4a58a6b337fe8a0eb44f211f33f278d3d5f commit: 173ff4a58a6b337fe8a0eb44f211f33f278d3d5f branch: master author: Cooper Lees committer: ?ukasz Langa date: 2017-08-01T15:35:45-07:00 summary: bpo-30897: Add is_mount() to pathlib.Path (#2669) * Add in is_mount() call to pathlib.Path similiar to os.path.ismount(path) * Add tests for is_mount() files: M Lib/pathlib.py M Lib/test/test_pathlib.py diff --git a/Lib/pathlib.py b/Lib/pathlib.py index 0e65c61f654..c14ddd03356 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -1329,6 +1329,27 @@ def is_file(self): # (see https://bitbucket.org/pitrou/pathlib/issue/12/) return False + def is_mount(self): + """ + Check if this path is a POSIX mount point + """ + # Need to exist and be a dir + if not self.exists() or not self.is_dir(): + return False + + parent = Path(self.parent) + try: + parent_dev = parent.stat().st_dev + except OSError: + return False + + dev = self.stat().st_dev + if dev != parent_dev: + return True + ino = self.stat().st_ino + parent_ino = parent.stat().st_ino + return ino == parent_ino + def is_symlink(self): """ Whether this path is a symbolic link. @@ -1416,3 +1437,6 @@ def owner(self): def group(self): raise NotImplementedError("Path.group() is unsupported on this system") + + def is_mount(self): + raise NotImplementedError("Path.is_mount() is unsupported on this system") diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index 16bfee0a47d..962adde38da 100644 --- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -1880,6 +1880,18 @@ def test_is_file(self): self.assertFalse((P / 'linkB').is_file()) self.assertFalse((P/ 'brokenLink').is_file()) + @only_posix + def test_is_mount(self): + P = self.cls(BASE) + R = self.cls('/') # TODO: Work out windows + self.assertFalse((P / 'fileA').is_mount()) + self.assertFalse((P / 'dirA').is_mount()) + self.assertFalse((P / 'non-existing').is_mount()) + self.assertFalse((P / 'fileA' / 'bah').is_mount()) + self.assertTrue(R.is_mount()) + if support.can_symlink(): + self.assertFalse((P / 'linkA').is_mount()) + def test_is_symlink(self): P = self.cls(BASE) self.assertFalse((P / 'fileA').is_symlink()) From webhook-mailer at python.org Tue Aug 1 18:41:36 2017 From: webhook-mailer at python.org (Yury Selivanov) Date: Tue, 01 Aug 2017 22:41:36 -0000 Subject: [Python-checkins] Add @1st1 as co-owner of asyncio and genobject (#2978) Message-ID: https://github.com/python/cpython/commit/9d8e6ec8d2f7d6abd6c526adabacc13fd1ab4ee1 commit: 9d8e6ec8d2f7d6abd6c526adabacc13fd1ab4ee1 branch: master author: Yury Selivanov committer: GitHub date: 2017-08-01T18:41:33-04:00 summary: Add @1st1 as co-owner of asyncio and genobject (#2978) files: M .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 1dc79f7dec6..137681b9a95 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -4,6 +4,12 @@ # It uses the same pattern rule for gitignore file # https://git-scm.com/docs/gitignore#_pattern_format +# asyncio +**/*asyncio* @1st1 + +# Core +**/*genobject* @1st1 + # Hashing **/*hashlib* @tiran **/*pyhash* @tiran From lp_benchmark_robot at intel.com Tue Aug 1 19:21:04 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 1 Aug 2017 16:21:04 -0700 Subject: [Python-checkins] [1 down, 64 flat] Results for Python (master branch) 2017-08-01 Message-ID: <095d4974-8b89-452b-b2f1-01eec80f90a6@orsmsx156.amr.corp.intel.com> Results for project python/master, build date: 2017-08-01 03:03:25-07:00. - commit: 6f446be - previous commit: a568e52 - revision date: 2017-08-01 00:24:07-04:00 - environment: Broadwell-EP - cpu: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz 2x22 cores, stepping 1, LLC 55 MB - mem: 128 GB - os: Ubuntu 16.04.2 LTS - kernel: 4.4.0-62-generic x86_64 GNU/Linux Baseline results were generated using release v3.6.0, with hash 5c4568a from 2016-12-22 23:38:47+00:00. +-----+------------------------+--------+------------+------------+------------+ | | |relative|change since|change since|current rev | | | benchmark|std_dev*| last run | baseline |run with PGO| +-----+------------------------+--------+------------+------------+------------+ | :-| | 2to3| 1.102% | -0.663% | +4.356% | +7.855% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method| 1.883% | -2.439% | +22.147% | +9.120% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_slots| 1.997% | -2.839% | +23.160% | +8.017% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_unknown| 1.081% | -0.587% | +21.774% | +6.320% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_simple| 3.036% | +2.591% | +8.144% | +10.918% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chameleon| 2.302% | +0.357% | +11.561% | +10.721% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chaos| 2.144% | -1.357% | +7.379% | +8.951% | +-----+------------------------+--------+------------+------------+------------+ | :-| | crypto_pyaes| 0.664% | -1.137% | +4.392% | +3.863% | +-----+------------------------+--------+------------+------------+------------+ | :-| | deltablue| 4.072% | +1.188% | +7.983% | +17.597% | +-----+------------------------+--------+------------+------------+------------+ | :-| | django_template| 4.307% | +0.592% | +10.048% | +11.798% | +-----+------------------------+--------+------------+------------+------------+ | :-| | dulwich_log| 1.267% | -0.534% | +3.380% | +5.536% | +-----+------------------------+--------+------------+------------+------------+ | :-| | fannkuch| 1.302% | -0.361% | +4.718% | +5.264% | +-----+------------------------+--------+------------+------------+------------+ | :-| | float| 0.903% | +0.893% | +4.499% | +5.124% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_text| 1.168% | +0.639% | +9.764% | +10.269% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_xml| 2.918% | -1.592% | +5.921% | +10.397% | +-----+------------------------+--------+------------+------------+------------+ | :-| | go| 0.967% | -1.787% | +5.962% | +11.358% | +-----+------------------------+--------+------------+------------+------------+ | :-| | hexiom| 0.701% | +0.059% | +10.409% | +10.061% | +-----+------------------------+--------+------------+------------+------------+ | :-| | html5lib| 3.372% | -1.231% | +8.054% | +11.049% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_dumps| 1.784% | +0.553% | +4.039% | +8.733% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_loads| 1.161% | +2.224% | +3.954% | +10.760% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_format| 1.454% | -0.762% | +9.830% | +9.416% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_silent| 2.795% | +0.679% | +47.507% | +11.760% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_simple| 1.578% | -0.977% | +10.383% | +10.800% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mako| 0.546% | +0.214% | +18.643% | +13.019% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mdp| 8.174% | -2.667% | +2.936% | +15.796% | +-----+------------------------+--------+------------+------------+------------+ | :-| | meteor_contest| 3.071% | +0.090% | +4.589% | +4.351% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nbody| 0.657% | -0.837% | -4.217% | +4.053% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nqueens| 3.607% | -0.676% | +1.882% | +6.802% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pathlib| 1.148% | -2.646% | +0.117% | +13.638% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle| 2.430% | -0.840% | +2.238% | +20.933% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_dict| 0.367% | +1.668% | +3.930% | +13.956% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_list| 0.829% | -1.867% | +3.959% | +17.561% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_pure_python| 3.734% | -0.060% | +12.357% | +10.358% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pidigits| 0.153% | -0.162% | +0.229% | +10.357% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup| 0.126% | -0.198% | +9.653% | +3.968% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup_no_site| 0.091% | -0.290% | +1.358% | +4.012% | +-----+------------------------+--------+------------+------------+------------+ | :-| | raytrace| 0.718% | +0.408% | +11.345% | +10.289% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_compile| 5.599% | +0.214% | -8.040% | +11.676% | +-----+------------------------+--------+------------+------------+------------+ | :-( | regex_dna| 0.699% | -4.113% | -1.857% | +12.731% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_effbot| 2.059% | +2.228% | +0.250% | +4.444% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_v8| 1.893% | -1.133% | +10.599% | +5.526% | +-----+------------------------+--------+------------+------------+------------+ | :-| | richards| 1.835% | -0.968% | +8.355% | +13.122% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_fft| 0.713% | +0.396% | +1.579% | -0.376% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_lu| 1.982% | +0.645% | +27.345% | +7.278% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_monte_carlo| 1.851% | +0.586% | +5.807% | +3.741% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sor| 0.552% | +0.178% | +16.177% | +4.747% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sparse_mat_mult| 0.697% | +2.788% | +3.584% | -5.444% | +-----+------------------------+--------+------------+------------+------------+ | :-| | spectral_norm| 0.818% | -0.009% | +6.376% | +0.455% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_declarative| 1.111% | -1.119% | +5.363% | +8.402% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_imperative| 2.944% | +0.606% | +5.353% | +4.868% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlite_synth| 4.460% | +0.794% | +3.047% | +8.044% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_expand| 2.311% | +0.107% | +12.880% | +8.102% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_integrate| 1.861% | +0.218% | +10.905% | +6.262% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_str| 3.465% | +0.754% | +13.005% | +8.428% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_sum| 4.751% | +0.378% | +13.737% | +9.884% | +-----+------------------------+--------+------------+------------+------------+ | :-| | telco| 2.872% | +1.919% | +22.791% | +10.657% | +-----+------------------------+--------+------------+------------+------------+ | :-| | tornado_http| 0.974% | -0.510% | +6.505% | +5.732% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpack_sequence| 1.620% | -2.400% | -0.376% | +2.126% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle| 8.963% | -0.522% | +7.906% | +21.512% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_list| 0.442% | -1.379% | -2.825% | +21.487% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_pure_python| 3.579% | -0.660% | +6.429% | +8.318% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_generate| 0.832% | -0.298% | +5.205% | +8.841% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_iterparse| 2.938% | +0.892% | +2.375% | +6.136% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_parse| 3.421% | +0.224% | -5.238% | +10.799% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_process| 1.034% | -0.367% | +6.192% | +8.925% | +-----+------------------------+--------+------------+------------+------------+ * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/1-down-64-flat-results-for-python-master-branch-2017-08-01 Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From webhook-mailer at python.org Tue Aug 1 19:47:53 2017 From: webhook-mailer at python.org (=?utf-8?q?=C5=81ukasz?= Langa) Date: Tue, 01 Aug 2017 23:47:53 -0000 Subject: [Python-checkins] Document Path.is_mount(), update Misc/ACKS and Misc/NEWS (#2980) Message-ID: https://github.com/python/cpython/commit/47320a652e872003f3dd3a9db4243067b09dd316 commit: 47320a652e872003f3dd3a9db4243067b09dd316 branch: master author: ?ukasz Langa committer: GitHub date: 2017-08-01T16:47:50-07:00 summary: Document Path.is_mount(), update Misc/ACKS and Misc/NEWS (#2980) files: A Misc/NEWS.d/next/Library/2017-08-01-15-56-50.bpo-30897.OuT1-Y.rst M Doc/library/pathlib.rst M Misc/ACKS diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index 0c9bd0d940a..3d28a1bea30 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -761,6 +761,18 @@ call fails (for example because the path doesn't exist): other errors (such as permission errors) are propagated. +.. method:: Path.is_mount() + + Return ``True`` if the path is a :dfn:`mount point`: a point in a + file system where a different file system has been mounted. On POSIX, the + function checks whether *path*'s parent, :file:`path/..`, is on a different + device than *path*, or whether :file:`path/..` and *path* point to the same + i-node on the same device --- this should detect mount points for all Unix + and POSIX variants. Not implemented on Windows. + + .. versionadded:: 3.7 + + .. method:: Path.is_symlink() Return ``True`` if the path points to a symbolic link, ``False`` otherwise. diff --git a/Misc/ACKS b/Misc/ACKS index e0640c114ff..f1f6c147f49 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -886,6 +886,7 @@ Inyeol Lee James Lee John J. Lee Thomas Lee +Cooper Ry Lees Tennessee Leeuwenburg Luc Lefebvre Pierre Paul Lefebvre diff --git a/Misc/NEWS.d/next/Library/2017-08-01-15-56-50.bpo-30897.OuT1-Y.rst b/Misc/NEWS.d/next/Library/2017-08-01-15-56-50.bpo-30897.OuT1-Y.rst new file mode 100644 index 00000000000..41a75b805ae --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-08-01-15-56-50.bpo-30897.OuT1-Y.rst @@ -0,0 +1,3 @@ +``pathlib.Path`` objects now include an ``is_mount()`` method (only +implemented on POSIX). This is similar to ``os.path.ismount(p)``. Patch by +Cooper Ry Lees. From webhook-mailer at python.org Wed Aug 2 02:31:10 2017 From: webhook-mailer at python.org (INADA Naoki) Date: Wed, 02 Aug 2017 06:31:10 -0000 Subject: [Python-checkins] bpo-31061: fix crash in asyncio speedup module (GH-2966) Message-ID: https://github.com/python/cpython/commit/de34cbe9cdaaf7b85fed86f99c2fd071e1a7b1d2 commit: de34cbe9cdaaf7b85fed86f99c2fd071e1a7b1d2 branch: master author: Alexander Mohr committer: INADA Naoki date: 2017-08-02T15:31:07+09:00 summary: bpo-31061: fix crash in asyncio speedup module (GH-2966) files: A Misc/NEWS.d/next/Library/2017-08-01-09-32-58.bpo-31061.husAYX.rst M Lib/test/test_asyncio/test_futures.py M Lib/test/test_asyncio/test_tasks.py M Modules/_asynciomodule.c diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py index ce657fc1b6a..ebedfec7fa3 100644 --- a/Lib/test/test_asyncio/test_futures.py +++ b/Lib/test/test_asyncio/test_futures.py @@ -1,6 +1,7 @@ """Tests for futures.py.""" import concurrent.futures +import gc import re import sys import threading @@ -19,9 +20,11 @@ def _fakefunc(f): return f + def first_cb(): pass + def last_cb(): pass @@ -483,6 +486,15 @@ def test_future_iter_throw(self): Exception("elephant"), Exception("elephant")) self.assertRaises(TypeError, fi.throw, list) + def test_future_del_collect(self): + class Evil: + def __del__(self): + gc.collect() + + for i in range(100): + fut = self._new_future(loop=self.loop) + fut.set_result(Evil()) + @unittest.skipUnless(hasattr(futures, '_CFuture'), 'requires the C _asyncio module') diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py index 686387f4f21..36082ec7c6a 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -3,6 +3,7 @@ import collections import contextlib import functools +import gc import io import os import re @@ -91,6 +92,20 @@ def setUp(self): self.loop.set_task_factory(self.new_task) self.loop.create_future = lambda: self.new_future(self.loop) + def test_task_del_collect(self): + class Evil: + def __del__(self): + gc.collect() + + @asyncio.coroutine + def run(): + return Evil() + + self.loop.run_until_complete( + asyncio.gather(*[ + self.new_task(self.loop, run()) for _ in range(100) + ], loop=self.loop)) + def test_other_loop_future(self): other_loop = asyncio.new_event_loop() fut = self.new_future(other_loop) diff --git a/Misc/NEWS.d/next/Library/2017-08-01-09-32-58.bpo-31061.husAYX.rst b/Misc/NEWS.d/next/Library/2017-08-01-09-32-58.bpo-31061.husAYX.rst new file mode 100644 index 00000000000..650e5f95f94 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-08-01-09-32-58.bpo-31061.husAYX.rst @@ -0,0 +1 @@ +Fixed a crash when using asyncio and threads. diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index b998a04e623..d4b313480e9 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -972,6 +972,8 @@ FutureObj_dealloc(PyObject *self) } } + PyObject_GC_UnTrack(self); + if (fut->fut_weakreflist != NULL) { PyObject_ClearWeakRefs(self); } @@ -1846,6 +1848,8 @@ TaskObj_dealloc(PyObject *self) } } + PyObject_GC_UnTrack(self); + if (task->task_weakreflist != NULL) { PyObject_ClearWeakRefs(self); } From webhook-mailer at python.org Wed Aug 2 03:50:44 2017 From: webhook-mailer at python.org (INADA Naoki) Date: Wed, 02 Aug 2017 07:50:44 -0000 Subject: [Python-checkins] bpo-31061: fix crash in asyncio speedup module (GH-2984) Message-ID: https://github.com/python/cpython/commit/f142e85d22ba135d5205280240f3a2fe1df2649f commit: f142e85d22ba135d5205280240f3a2fe1df2649f branch: 3.6 author: INADA Naoki committer: GitHub date: 2017-08-02T16:50:39+09:00 summary: bpo-31061: fix crash in asyncio speedup module (GH-2984) (cherry picked from commit de34cbe9cdaaf7b85fed86f99c2fd071e1a7b1d2) files: A Misc/NEWS.d/next/Library/2017-08-01-09-32-58.bpo-31061.husAYX.rst M Lib/test/test_asyncio/test_futures.py M Lib/test/test_asyncio/test_tasks.py M Modules/_asynciomodule.c diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py index ce657fc1b6a..ebedfec7fa3 100644 --- a/Lib/test/test_asyncio/test_futures.py +++ b/Lib/test/test_asyncio/test_futures.py @@ -1,6 +1,7 @@ """Tests for futures.py.""" import concurrent.futures +import gc import re import sys import threading @@ -19,9 +20,11 @@ def _fakefunc(f): return f + def first_cb(): pass + def last_cb(): pass @@ -483,6 +486,15 @@ def test_future_iter_throw(self): Exception("elephant"), Exception("elephant")) self.assertRaises(TypeError, fi.throw, list) + def test_future_del_collect(self): + class Evil: + def __del__(self): + gc.collect() + + for i in range(100): + fut = self._new_future(loop=self.loop) + fut.set_result(Evil()) + @unittest.skipUnless(hasattr(futures, '_CFuture'), 'requires the C _asyncio module') diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py index 195a1ed4077..243faf6b049 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -3,6 +3,7 @@ import collections import contextlib import functools +import gc import io import os import re @@ -92,6 +93,20 @@ def setUp(self): self.loop.set_task_factory(self.new_task) self.loop.create_future = lambda: self.new_future(self.loop) + def test_task_del_collect(self): + class Evil: + def __del__(self): + gc.collect() + + @asyncio.coroutine + def run(): + return Evil() + + self.loop.run_until_complete( + asyncio.gather(*[ + self.new_task(self.loop, run()) for _ in range(100) + ], loop=self.loop)) + def test_other_loop_future(self): other_loop = asyncio.new_event_loop() fut = self.new_future(other_loop) diff --git a/Misc/NEWS.d/next/Library/2017-08-01-09-32-58.bpo-31061.husAYX.rst b/Misc/NEWS.d/next/Library/2017-08-01-09-32-58.bpo-31061.husAYX.rst new file mode 100644 index 00000000000..650e5f95f94 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-08-01-09-32-58.bpo-31061.husAYX.rst @@ -0,0 +1 @@ +Fixed a crash when using asyncio and threads. diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index 8fbd565dd9c..c48cbbc263d 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -971,6 +971,8 @@ FutureObj_dealloc(PyObject *self) } } + PyObject_GC_UnTrack(self); + if (fut->fut_weakreflist != NULL) { PyObject_ClearWeakRefs(self); } @@ -1845,6 +1847,8 @@ TaskObj_dealloc(PyObject *self) } } + PyObject_GC_UnTrack(self); + if (task->task_weakreflist != NULL) { PyObject_ClearWeakRefs(self); } From webhook-mailer at python.org Wed Aug 2 04:33:36 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Wed, 02 Aug 2017 08:33:36 -0000 Subject: [Python-checkins] bpo-29902: Emit a Py3k deprecation warning when pickling or copying (#2823) Message-ID: https://github.com/python/cpython/commit/3dd1ccbb0950b2b83713a495958c35d60b453fa9 commit: 3dd1ccbb0950b2b83713a495958c35d60b453fa9 branch: 2.7 author: Serhiy Storchaka committer: GitHub date: 2017-08-02T11:33:33+03:00 summary: bpo-29902: Emit a Py3k deprecation warning when pickling or copying (#2823) some builtin and extension objects that don't support pickling explicitly and are pickled incorrectly by default (like memoryview or staticmethod). files: A Misc/NEWS.d/next/Library/2017-07-23-13-47-22.bpo-29902.CiuFdn.rst M Lib/test/test_buffer.py M Lib/test/test_descr.py M Lib/test/test_memoryview.py M Objects/typeobject.c diff --git a/Lib/test/test_buffer.py b/Lib/test/test_buffer.py index de80d4469d7..c7114cde8b9 100644 --- a/Lib/test/test_buffer.py +++ b/Lib/test/test_buffer.py @@ -8,6 +8,7 @@ import pickle import sys import unittest +import warnings from test import test_support class BufferTests(unittest.TestCase): @@ -39,15 +40,19 @@ def test_large_buffer_size_and_offset(self): def test_copy(self): buf = buffer(b'abc') - with self.assertRaises(TypeError): + with self.assertRaises(TypeError), warnings.catch_warnings(): + warnings.filterwarnings('ignore', ".*buffer", DeprecationWarning) copy.copy(buf) - # See issue #22995 - ## def test_pickle(self): - ## buf = buffer(b'abc') - ## for proto in range(pickle.HIGHEST_PROTOCOL + 1): - ## with self.assertRaises(TypeError): - ## pickle.dumps(buf, proto) + @test_support.cpython_only + def test_pickle(self): + buf = buffer(b'abc') + for proto in range(2): + with self.assertRaises(TypeError): + pickle.dumps(buf, proto) + with test_support.check_py3k_warnings( + (".*buffer", DeprecationWarning)): + pickle.dumps(buf, 2) def test_main(): diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 1e63761f6d0..bbc52aa6791 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -1,5 +1,7 @@ import __builtin__ +import copy import gc +import pickle import sys import types import unittest @@ -10,6 +12,10 @@ from test import test_support +def func(*args): + return args + + class OperatorsTest(unittest.TestCase): def __init__(self, *args, **kwargs): @@ -1415,6 +1421,21 @@ def f(cls, arg): return (cls, arg) else: self.fail("classmethod shouldn't accept keyword args") + @test_support.cpython_only + def test_classmethod_copy_pickle(self): + cm = classmethod(func) + with test_support.check_py3k_warnings( + (".*classmethod", DeprecationWarning)): + copy.copy(cm) + with test_support.check_py3k_warnings( + (".*classmethod", DeprecationWarning)): + copy.deepcopy(cm) + for proto in range(2): + self.assertRaises(TypeError, pickle.dumps, cm, proto) + with test_support.check_py3k_warnings( + (".*classmethod", DeprecationWarning)): + pickle.dumps(cm, 2) + @test_support.impl_detail("the module 'xxsubtype' is internal") def test_classmethods_in_c(self): # Testing C-based class methods... @@ -1463,6 +1484,21 @@ class D(C): self.assertEqual(d.foo(1), (d, 1)) self.assertEqual(D.foo(d, 1), (d, 1)) + @test_support.cpython_only + def test_staticmethod_copy_pickle(self): + sm = staticmethod(func) + with test_support.check_py3k_warnings( + (".*staticmethod", DeprecationWarning)): + copy.copy(sm) + with test_support.check_py3k_warnings( + (".*staticmethod", DeprecationWarning)): + copy.deepcopy(sm) + for proto in range(2): + self.assertRaises(TypeError, pickle.dumps, sm, proto) + with test_support.check_py3k_warnings( + (".*staticmethod", DeprecationWarning)): + pickle.dumps(sm, 2) + @test_support.impl_detail("the module 'xxsubtype' is internal") def test_staticmethods_in_c(self): # Testing C-based static methods... @@ -2158,6 +2194,21 @@ class D(object): else: self.fail("expected ZeroDivisionError from bad property") + @test_support.cpython_only + def test_property_copy_pickle(self): + p = property(func) + with test_support.check_py3k_warnings( + (".*property", DeprecationWarning)): + copy.copy(p) + with test_support.check_py3k_warnings( + (".*property", DeprecationWarning)): + copy.deepcopy(p) + for proto in range(2): + self.assertRaises(TypeError, pickle.dumps, p, proto) + with test_support.check_py3k_warnings( + (".*property", DeprecationWarning)): + pickle.dumps(p, 2) + @unittest.skipIf(sys.flags.optimize >= 2, "Docstrings are omitted with -O2 and above") def test_properties_doc_attrib(self): diff --git a/Lib/test/test_memoryview.py b/Lib/test/test_memoryview.py index 4407af82642..42698583f9f 100644 --- a/Lib/test/test_memoryview.py +++ b/Lib/test/test_memoryview.py @@ -12,6 +12,7 @@ import io import copy import pickle +import warnings class AbstractMemoryTests: @@ -359,15 +360,20 @@ class BytesMemorySliceSliceTest(unittest.TestCase, class OtherTest(unittest.TestCase): def test_copy(self): m = memoryview(b'abc') - with self.assertRaises(TypeError): + with self.assertRaises(TypeError), warnings.catch_warnings(): + warnings.filterwarnings('ignore', ".*memoryview", DeprecationWarning) copy.copy(m) - # See issue #22995 - ## def test_pickle(self): - ## m = memoryview(b'abc') - ## for proto in range(pickle.HIGHEST_PROTOCOL + 1): - ## with self.assertRaises(TypeError): - ## pickle.dumps(m, proto) + @test_support.cpython_only + def test_pickle(self): + m = memoryview(b'abc') + for proto in range(2): + with self.assertRaises(TypeError): + pickle.dumps(m, proto) + with test_support.check_py3k_warnings( + (".*memoryview", DeprecationWarning)): + pickle.dumps(m, 2) + def test_main(): diff --git a/Misc/NEWS.d/next/Library/2017-07-23-13-47-22.bpo-29902.CiuFdn.rst b/Misc/NEWS.d/next/Library/2017-07-23-13-47-22.bpo-29902.CiuFdn.rst new file mode 100644 index 00000000000..6aa6605be3e --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-07-23-13-47-22.bpo-29902.CiuFdn.rst @@ -0,0 +1,4 @@ +Py3k deprecation warning now is emitted when pickling or copying some builtin +and extension objects that don't support pickling explicitly and are pickled +incorrectly by default (like memoryview or staticmethod). This is a +TypeError in Python 3.6. diff --git a/Objects/typeobject.c b/Objects/typeobject.c index eb5f5a4e9dd..685c5457737 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -3366,6 +3366,29 @@ reduce_2(PyObject *obj) goto end; assert(names == Py_None || PyList_Check(names)); + if (required_state && Py_Py3kWarningFlag) { + Py_ssize_t basicsize = PyBaseObject_Type.tp_basicsize; + if (obj->ob_type->tp_dictoffset) + basicsize += sizeof(PyObject *); + if (obj->ob_type->tp_weaklistoffset) + basicsize += sizeof(PyObject *); + if (names != Py_None) + basicsize += sizeof(PyObject *) * PyList_GET_SIZE(names); + if (obj->ob_type->tp_basicsize > basicsize) { + PyObject *msg = PyString_FromFormat( + "can't pickle %.200s objects", + Py_TYPE(obj)->tp_name); + if (msg == NULL) { + goto end; + } + if (PyErr_WarnPy3k(PyString_AS_STRING(msg), 1) < 0) { + Py_DECREF(msg); + goto end; + } + Py_DECREF(msg); + } + } + if (names != Py_None) { slots = PyDict_New(); if (slots == NULL) From solipsis at pitrou.net Wed Aug 2 05:07:52 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 02 Aug 2017 09:07:52 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=-2 Message-ID: <20170802090751.16075.63C9ECA3C59BCB9E@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [-7, 1, 0] memory blocks, sum=-6 test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogoA48q1', '--timeout', '7200'] From webhook-mailer at python.org Wed Aug 2 16:44:33 2017 From: webhook-mailer at python.org (Vinay Sajip) Date: Wed, 02 Aug 2017 20:44:33 -0000 Subject: [Python-checkins] bpo-31080: Allowed logging.config.fileConfig() to accept both args and kwargs. (GH-2979) Message-ID: https://github.com/python/cpython/commit/6ea56d2ebcae69257f8dd7af28c357b25bf394c3 commit: 6ea56d2ebcae69257f8dd7af28c357b25bf394c3 branch: master author: Preston Landers committer: Vinay Sajip date: 2017-08-02T21:44:28+01:00 summary: bpo-31080: Allowed logging.config.fileConfig() to accept both args and kwargs. (GH-2979) files: A Misc/NEWS.d/next/Library/2017-08-01-18-26-55.bpo-31080.2CFVCO.rst M Doc/library/logging.config.rst M Lib/logging/config.py M Lib/test/test_logging.py diff --git a/Doc/library/logging.config.rst b/Doc/library/logging.config.rst index a7928a0647c..06378379c33 100644 --- a/Doc/library/logging.config.rst +++ b/Doc/library/logging.config.rst @@ -715,7 +715,12 @@ a corresponding section in the configuration file. The ``args`` entry, when :func:`eval`\ uated in the context of the ``logging`` package's namespace, is the list of arguments to the constructor for the handler class. Refer to the constructors for the relevant handlers, or to the examples -below, to see how typical entries are constructed. +below, to see how typical entries are constructed. If not provided, it defaults +to ``()``. + +The optional ``kwargs`` entry, when :func:`eval`\ uated in the context of the +``logging`` package's namespace, is the keyword argument dict to the constructor +for the handler class. If not provided, it defaults to ``{}``. .. code-block:: ini @@ -754,6 +759,7 @@ below, to see how typical entries are constructed. level=WARN formatter=form07 args=('localhost', 'from at abc', ['user1 at abc', 'user2 at xyz'], 'Logger Subject') + kwargs={'timeout': 10.0} [handler_hand08] class=handlers.MemoryHandler @@ -767,6 +773,7 @@ below, to see how typical entries are constructed. level=NOTSET formatter=form09 args=('localhost:9022', '/log', 'GET') + kwargs={'secure': True} Sections which specify formatter configuration are typified by the following. diff --git a/Lib/logging/config.py b/Lib/logging/config.py index d692514adfe..b3f4e28796a 100644 --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -143,9 +143,11 @@ def _install_handlers(cp, formatters): klass = eval(klass, vars(logging)) except (AttributeError, NameError): klass = _resolve(klass) - args = section["args"] + args = section.get("args", '()') args = eval(args, vars(logging)) - h = klass(*args) + kwargs = section.get("kwargs", '{}') + kwargs = eval(kwargs, vars(logging)) + h = klass(*args, **kwargs) if "level" in section: level = section["level"] h.setLevel(level) diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 36ea0725153..a91cfd4ccd3 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -1273,7 +1273,7 @@ class ConfigFileTest(BaseTest): datefmt= """ - # config7 adds a compiler logger. + # config7 adds a compiler logger, and uses kwargs instead of args. config7 = """ [loggers] keys=root,parser,compiler @@ -1304,7 +1304,7 @@ class ConfigFileTest(BaseTest): class=StreamHandler level=NOTSET formatter=form1 - args=(sys.stdout,) + kwargs={'stream': sys.stdout,} [formatter_form1] format=%(levelname)s ++ %(message)s diff --git a/Misc/NEWS.d/next/Library/2017-08-01-18-26-55.bpo-31080.2CFVCO.rst b/Misc/NEWS.d/next/Library/2017-08-01-18-26-55.bpo-31080.2CFVCO.rst new file mode 100644 index 00000000000..afa2d532c5c --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-08-01-18-26-55.bpo-31080.2CFVCO.rst @@ -0,0 +1 @@ +Allow `logging.config.fileConfig` to accept kwargs and/or args. From webhook-mailer at python.org Wed Aug 2 18:50:55 2017 From: webhook-mailer at python.org (Mariatta) Date: Wed, 02 Aug 2017 22:50:55 -0000 Subject: [Python-checkins] Add @bitdancer as codeowner of email related stuff. (GH-2987) Message-ID: https://github.com/python/cpython/commit/d9d55c91bec4776b41685b48fe660621e89f0617 commit: d9d55c91bec4776b41685b48fe660621e89f0617 branch: master author: R. David Murray committer: Mariatta date: 2017-08-02T15:50:50-07:00 summary: Add @bitdancer as codeowner of email related stuff. (GH-2987) files: M .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 137681b9a95..1c5164f6640 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -19,3 +19,10 @@ # SSL **/*ssl* @tiran + +# Email and related +**/*mail* @bitdancer +**/*smtp* @bitdancer +**/*mime* @bitdancer +**/*imap* @bitdancer +**/*poplib* @bitdancer From lp_benchmark_robot at intel.com Wed Aug 2 19:27:48 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 2 Aug 2017 16:27:48 -0700 Subject: [Python-checkins] [65 flat] Results for Python (master branch) 2017-08-02 Message-ID: <8b3e9571-fcd6-4a77-a53f-ee094e3fe37f@orsmsx110.amr.corp.intel.com> Results for project python/master, build date: 2017-08-02 03:03:27-07:00. - commit: de34cbe - previous commit: 6f446be - revision date: 2017-08-02 15:31:07+09:00 - environment: Broadwell-EP - cpu: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz 2x22 cores, stepping 1, LLC 55 MB - mem: 128 GB - os: Ubuntu 16.04.2 LTS - kernel: 4.4.0-62-generic x86_64 GNU/Linux Baseline results were generated using release v3.6.0, with hash 5c4568a from 2016-12-22 23:38:47+00:00. +-----+------------------------+--------+------------+------------+------------+ | | |relative|change since|change since|current rev | | | benchmark|std_dev*| last run | baseline |run with PGO| +-----+------------------------+--------+------------+------------+------------+ | :-| | 2to3| 1.106% | +0.313% | +4.655% | +8.041% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method| 2.081% | +0.241% | +22.334% | +13.474% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_slots| 2.009% | -0.204% | +23.003% | +12.051% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_unknown| 1.147% | -0.298% | +21.541% | +11.142% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_simple| 3.367% | -0.969% | +7.253% | +12.763% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chameleon| 1.507% | +0.108% | +11.657% | +11.247% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chaos| 0.675% | +0.235% | +7.596% | +9.920% | +-----+------------------------+--------+------------+------------+------------+ | :-| | crypto_pyaes| 0.785% | -0.006% | +4.386% | +5.309% | +-----+------------------------+--------+------------+------------+------------+ | :-| | deltablue| 3.922% | +0.282% | +8.242% | +16.473% | +-----+------------------------+--------+------------+------------+------------+ | :-| | django_template| 4.376% | -0.205% | +9.864% | +11.987% | +-----+------------------------+--------+------------+------------+------------+ | :-| | dulwich_log| 1.132% | +0.117% | +3.493% | +6.498% | +-----+------------------------+--------+------------+------------+------------+ | :-| | fannkuch| 0.948% | -0.150% | +4.575% | +7.405% | +-----+------------------------+--------+------------+------------+------------+ | :-| | float| 1.112% | -0.079% | +4.424% | +4.213% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_text| 1.210% | -0.100% | +9.673% | +11.192% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_xml| 2.738% | +1.593% | +7.420% | +10.183% | +-----+------------------------+--------+------------+------------+------------+ | :-| | go| 1.249% | +0.146% | +6.100% | +11.250% | +-----+------------------------+--------+------------+------------+------------+ | :-| | hexiom| 1.297% | -0.054% | +10.361% | +10.632% | +-----+------------------------+--------+------------+------------+------------+ | :-| | html5lib| 3.352% | +0.425% | +8.444% | +9.853% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_dumps| 1.282% | +0.292% | +4.319% | +8.553% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_loads| 1.427% | -0.144% | +3.816% | +9.007% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_format| 1.438% | -0.963% | +8.962% | +12.120% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_silent| 2.659% | -0.185% | +47.410% | +11.134% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_simple| 1.323% | -0.042% | +10.346% | +13.363% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mako| 0.638% | +0.216% | +18.820% | +10.936% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mdp| 7.155% | +1.142% | +4.045% | +13.494% | +-----+------------------------+--------+------------+------------+------------+ | :-| | meteor_contest| 1.978% | -0.936% | +3.696% | +5.994% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nbody| 0.545% | +0.005% | -4.212% | +5.504% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nqueens| 3.197% | +0.214% | +2.093% | +7.834% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pathlib| 1.221% | -0.079% | +0.038% | +14.917% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle| 1.842% | +0.345% | +2.576% | +21.008% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_dict| 0.572% | -0.116% | +3.819% | +18.041% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_list| 0.912% | -0.031% | +3.929% | +20.216% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_pure_python| 3.463% | +0.570% | +12.856% | +9.739% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pidigits| 0.228% | -0.035% | +0.194% | +9.677% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup| 0.120% | -0.043% | +9.614% | +4.250% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup_no_site| 0.090% | +0.028% | +1.386% | +4.207% | +-----+------------------------+--------+------------+------------+------------+ | :-| | raytrace| 0.895% | -0.093% | +11.262% | +11.854% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_compile| 4.138% | +2.352% | -5.500% | +10.197% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_dna| 0.248% | +0.169% | -1.685% | +12.103% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_effbot| 2.348% | -0.374% | -0.123% | +3.039% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_v8| 0.857% | +0.231% | +10.805% | +4.854% | +-----+------------------------+--------+------------+------------+------------+ | :-| | richards| 0.921% | +0.401% | +8.722% | +13.159% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_fft| 1.351% | -0.169% | +1.412% | +4.534% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_lu| 2.684% | -0.889% | +26.699% | +9.936% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_monte_carlo| 1.908% | +0.392% | +6.176% | +3.536% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sor| 1.245% | -0.351% | +15.882% | +7.187% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sparse_mat_mult| 2.041% | -0.439% | +3.160% | +1.326% | +-----+------------------------+--------+------------+------------+------------+ | :-| | spectral_norm| 0.838% | +0.039% | +6.412% | +3.044% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_declarative| 1.062% | +0.100% | +5.458% | +8.069% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_imperative| 3.188% | +0.153% | +5.498% | +5.050% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlite_synth| 4.218% | -1.171% | +1.912% | +9.092% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_expand| 2.104% | +0.271% | +13.116% | +8.182% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_integrate| 1.622% | +0.149% | +11.038% | +6.045% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_str| 3.857% | -0.632% | +12.455% | +9.362% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_sum| 4.481% | +0.230% | +13.935% | +9.522% | +-----+------------------------+--------+------------+------------+------------+ | :-| | telco| 5.782% | -1.412% | +21.701% | +12.874% | +-----+------------------------+--------+------------+------------+------------+ | :-| | tornado_http| 1.292% | -0.329% | +6.197% | +6.677% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpack_sequence| 1.293% | +0.451% | +0.077% | +1.619% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle| 8.750% | +1.278% | +9.083% | +19.383% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_list| 2.095% | -1.051% | -3.906% | +20.727% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_pure_python| 3.162% | +0.351% | +6.758% | +8.277% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_generate| 0.932% | -0.193% | +5.022% | +9.252% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_iterparse| 2.082% | +0.065% | +2.439% | +6.548% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_parse| 2.185% | -0.136% | -5.382% | +9.957% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_process| 1.686% | -0.422% | +5.796% | +9.222% | +-----+------------------------+--------+------------+------------+------------+ * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/65-flat-results-for-python-master-branch-2017-08-02 Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From webhook-mailer at python.org Thu Aug 3 02:01:02 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Thu, 03 Aug 2017 06:01:02 -0000 Subject: [Python-checkins] Spelling fixes (#2902) Message-ID: https://github.com/python/cpython/commit/49b2734bf12dc1cda80fd73d3ec8896ae3e362f2 commit: 49b2734bf12dc1cda80fd73d3ec8896ae3e362f2 branch: master author: Ville Skytt? committer: Serhiy Storchaka date: 2017-08-03T09:00:59+03:00 summary: Spelling fixes (#2902) files: M Doc/library/sys.rst M Include/abstract.h M Include/unicodeobject.h M Lib/enum.py M Lib/idlelib/configdialog.py M Lib/test/decimaltestdata/ddDivide.decTest M Lib/test/decimaltestdata/ddDivideInt.decTest M Lib/test/decimaltestdata/ddFMA.decTest M Lib/test/decimaltestdata/ddMultiply.decTest M Lib/test/decimaltestdata/divide.decTest M Lib/test/decimaltestdata/dqDivide.decTest M Lib/test/decimaltestdata/dqDivideInt.decTest M Lib/test/decimaltestdata/dqFMA.decTest M Lib/test/decimaltestdata/dqMultiply.decTest M Lib/test/decimaltestdata/fma.decTest M Lib/test/decimaltestdata/multiply.decTest M Lib/test/test_binop.py M Lib/test/test_functools.py M Lib/test/test_importlib/import_/test___package__.py M Lib/test/test_os.py M Lib/test/test_subprocess.py M Lib/test/test_warnings/__init__.py M Lib/unittest/test/testmock/testmagicmethods.py M Misc/HISTORY M Misc/NEWS M Modules/_ctypes/_ctypes.c M Modules/_lzmamodule.c M Modules/posixmodule.c M Python/ceval.c diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 54b99e0fd99..8b94929c500 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -610,7 +610,7 @@ always available. :class:`~collections.namedtuple` of the form `(firstiter, finalizer)`, where *firstiter* and *finalizer* are expected to be either ``None`` or functions which take an :term:`asynchronous generator iterator` as an - argument, and are used to schedule finalization of an asychronous + argument, and are used to schedule finalization of an asynchronous generator by an event loop. .. versionadded:: 3.6 diff --git a/Include/abstract.h b/Include/abstract.h index fe089dcbb56..8969019e30c 100644 --- a/Include/abstract.h +++ b/Include/abstract.h @@ -170,7 +170,7 @@ PyAPI_FUNC(PyObject*) _PyStack_AsTupleSlice( format to a Python dictionary ("kwargs" dict). The type of kwnames keys is not checked. The final function getting - arguments is reponsible to check if all keys are strings, for example using + arguments is responsible to check if all keys are strings, for example using PyArg_ParseTupleAndKeywords() or PyArg_ValidateKeywordArguments(). Duplicate keys are merged using the last value. If duplicate keys must raise diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h index bb91568cb4e..5ca1f87013f 100644 --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -1227,7 +1227,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_Encode( /* Encodes a Unicode object and returns the result as Python object. - This API is DEPRECATED. It is superceeded by PyUnicode_AsEncodedString() + This API is DEPRECATED. It is superseded by PyUnicode_AsEncodedString() since all standard encodings (except rot13) encode str to bytes. Use PyCodec_Encode() for encoding with rot13 and non-standard codecs that encode form str to non-bytes. */ diff --git a/Lib/enum.py b/Lib/enum.py index 73dd613887d..6d90f7dd65f 100644 --- a/Lib/enum.py +++ b/Lib/enum.py @@ -840,7 +840,7 @@ def _decompose(flag, value): not_covered = value negative = value < 0 # issue29167: wrap accesses to _value2member_map_ in a list to avoid race - # conditions between iterating over it and having more psuedo- + # conditions between iterating over it and having more pseudo- # members added to it if negative: # only check for named flags diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py index 6d8a03b1c00..f7a6b7367e4 100644 --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -1216,7 +1216,7 @@ def create_page_extensions(self): which are boolean, and can be toggled with a True/False button. Methods: - load_extentions: + load_extensions: extension_selected: Handle selection from list. create_extension_frame: Hold widgets for one extension. set_extension_value: Set in userCfg['extensions']. diff --git a/Lib/test/decimaltestdata/ddDivide.decTest b/Lib/test/decimaltestdata/ddDivide.decTest index 5531d0e0315..5b2651b2b66 100644 --- a/Lib/test/decimaltestdata/ddDivide.decTest +++ b/Lib/test/decimaltestdata/ddDivide.decTest @@ -579,7 +579,7 @@ dddiv1056 divide 1e-277 -1e+311 -> -0E-398 Underflow Subnormal Inexact Rounded dddiv1057 divide -1e-277 1e+311 -> -0E-398 Underflow Subnormal Inexact Rounded Clamped dddiv1058 divide -1e-277 -1e+311 -> 0E-398 Underflow Subnormal Inexact Rounded Clamped --- 'subnormal' boundary (all hard underflow or overflow in base arithemtic) +-- 'subnormal' boundary (all hard underflow or overflow in base arithmetic) dddiv1060 divide 1e-291 1e+101 -> 1E-392 Subnormal dddiv1061 divide 1e-291 1e+102 -> 1E-393 Subnormal dddiv1062 divide 1e-291 1e+103 -> 1E-394 Subnormal diff --git a/Lib/test/decimaltestdata/ddDivideInt.decTest b/Lib/test/decimaltestdata/ddDivideInt.decTest index 1555b4217dc..342d13041b1 100644 --- a/Lib/test/decimaltestdata/ddDivideInt.decTest +++ b/Lib/test/decimaltestdata/ddDivideInt.decTest @@ -248,7 +248,7 @@ dddvi1056 divideint 1e-277 -1e+311 -> -0 dddvi1057 divideint -1e-277 1e+311 -> -0 dddvi1058 divideint -1e-277 -1e+311 -> 0 --- 'subnormal' boundary (all hard underflow or overflow in base arithemtic) +-- 'subnormal' boundary (all hard underflow or overflow in base arithmetic) dddvi1060 divideint 1e-291 1e+101 -> 0 dddvi1061 divideint 1e-291 1e+102 -> 0 dddvi1062 divideint 1e-291 1e+103 -> 0 diff --git a/Lib/test/decimaltestdata/ddFMA.decTest b/Lib/test/decimaltestdata/ddFMA.decTest index f0acfc74d53..9094fc015bd 100644 --- a/Lib/test/decimaltestdata/ddFMA.decTest +++ b/Lib/test/decimaltestdata/ddFMA.decTest @@ -26,7 +26,7 @@ extended: 1 clamp: 1 rounding: half_even --- These tests comprese three parts: +-- These tests comprise three parts: -- 1. Sanity checks and other three-operand tests (especially those -- where the fused operation makes a difference) -- 2. Multiply tests (third operand is neutral zero [0E+emax]) @@ -458,7 +458,7 @@ ddfma2756 fma 1e-277 -1e-311 0e+384 -> -0E-398 Underflow Subnormal Inexact ddfma2757 fma -1e-277 1e-311 0e+384 -> -0E-398 Underflow Subnormal Inexact Rounded Clamped ddfma2758 fma -1e-277 -1e-311 0e+384 -> 0E-398 Underflow Subnormal Inexact Rounded Clamped --- 'subnormal' boundary (all hard underflow or overflow in base arithemtic) +-- 'subnormal' boundary (all hard underflow or overflow in base arithmetic) ddfma2760 fma 1e-291 1e-101 0e+384 -> 1E-392 Subnormal ddfma2761 fma 1e-291 1e-102 0e+384 -> 1E-393 Subnormal ddfma2762 fma 1e-291 1e-103 0e+384 -> 1E-394 Subnormal diff --git a/Lib/test/decimaltestdata/ddMultiply.decTest b/Lib/test/decimaltestdata/ddMultiply.decTest index 45a381dc619..b7342ac2fe7 100644 --- a/Lib/test/decimaltestdata/ddMultiply.decTest +++ b/Lib/test/decimaltestdata/ddMultiply.decTest @@ -347,7 +347,7 @@ ddmul756 multiply 1e-277 -1e-311 -> -0E-398 Underflow Subnormal Inexact Rounded ddmul757 multiply -1e-277 1e-311 -> -0E-398 Underflow Subnormal Inexact Rounded Clamped ddmul758 multiply -1e-277 -1e-311 -> 0E-398 Underflow Subnormal Inexact Rounded Clamped --- 'subnormal' boundary (all hard underflow or overflow in base arithemtic) +-- 'subnormal' boundary (all hard underflow or overflow in base arithmetic) ddmul760 multiply 1e-291 1e-101 -> 1E-392 Subnormal ddmul761 multiply 1e-291 1e-102 -> 1E-393 Subnormal ddmul762 multiply 1e-291 1e-103 -> 1E-394 Subnormal diff --git a/Lib/test/decimaltestdata/divide.decTest b/Lib/test/decimaltestdata/divide.decTest index efbb5baf855..a51aa5d935e 100644 --- a/Lib/test/decimaltestdata/divide.decTest +++ b/Lib/test/decimaltestdata/divide.decTest @@ -759,7 +759,7 @@ divx959 divide 9E-999999999 -9.100 -> -9.8901099E-1000000000 Inexact Rounded Und -- overflow and underflow (additional edge tests in multiply.decTest) -- 'subnormal' results now possible (all hard underflow or overflow in --- base arithemtic) +-- base arithmetic) divx960 divide 1e-600000000 1e+400000001 -> 1E-1000000001 Subnormal divx961 divide 1e-600000000 1e+400000002 -> 1E-1000000002 Subnormal divx962 divide 1e-600000000 1e+400000003 -> 1E-1000000003 Subnormal diff --git a/Lib/test/decimaltestdata/dqDivide.decTest b/Lib/test/decimaltestdata/dqDivide.decTest index 3cf60c60241..1d623ff4123 100644 --- a/Lib/test/decimaltestdata/dqDivide.decTest +++ b/Lib/test/decimaltestdata/dqDivide.decTest @@ -580,7 +580,7 @@ dqdiv1756 divide 1e-4277 -1e+3311 -> -0E-6176 Underflow Subnormal Inexact Round dqdiv1757 divide -1e-4277 1e+3311 -> -0E-6176 Underflow Subnormal Inexact Rounded Clamped dqdiv1758 divide -1e-4277 -1e+3311 -> 0E-6176 Underflow Subnormal Inexact Rounded Clamped --- 'subnormal' boundary (all hard underflow or overflow in base arithemtic) +-- 'subnormal' boundary (all hard underflow or overflow in base arithmetic) dqdiv1760 divide 1e-6069 1e+101 -> 1E-6170 Subnormal dqdiv1761 divide 1e-6069 1e+102 -> 1E-6171 Subnormal dqdiv1762 divide 1e-6069 1e+103 -> 1E-6172 Subnormal diff --git a/Lib/test/decimaltestdata/dqDivideInt.decTest b/Lib/test/decimaltestdata/dqDivideInt.decTest index 3fec6dbaa37..ed74fe61386 100644 --- a/Lib/test/decimaltestdata/dqDivideInt.decTest +++ b/Lib/test/decimaltestdata/dqDivideInt.decTest @@ -249,7 +249,7 @@ dqdvi1056 divideint 1e-277 -1e+311 -> -0 dqdvi1057 divideint -1e-277 1e+311 -> -0 dqdvi1058 divideint -1e-277 -1e+311 -> 0 --- 'subnormal' boundary (all hard underflow or overflow in base arithemtic) +-- 'subnormal' boundary (all hard underflow or overflow in base arithmetic) dqdvi1060 divideint 1e-291 1e+101 -> 0 dqdvi1061 divideint 1e-291 1e+102 -> 0 dqdvi1062 divideint 1e-291 1e+103 -> 0 diff --git a/Lib/test/decimaltestdata/dqFMA.decTest b/Lib/test/decimaltestdata/dqFMA.decTest index 2353f2fa2cb..caa24025a75 100644 --- a/Lib/test/decimaltestdata/dqFMA.decTest +++ b/Lib/test/decimaltestdata/dqFMA.decTest @@ -26,7 +26,7 @@ maxExponent: 6144 minExponent: -6143 rounding: half_even --- These tests comprese three parts: +-- These tests comprise three parts: -- 1. Sanity checks and other three-operand tests (especially those -- where the fused operation makes a difference) -- 2. Multiply tests (third operand is neutral zero [0E+emax]) @@ -476,7 +476,7 @@ dqfma2756 fma 1e-4277 -1e-3311 0e+6144 -> -0E-6176 Underflow Subnormal Inex dqfma2757 fma -1e-4277 1e-3311 0e+6144 -> -0E-6176 Underflow Subnormal Inexact Rounded Clamped dqfma2758 fma -1e-4277 -1e-3311 0e+6144 -> 0E-6176 Underflow Subnormal Inexact Rounded Clamped --- 'subnormal' boundary (all hard underflow or overflow in base arithemtic) +-- 'subnormal' boundary (all hard underflow or overflow in base arithmetic) dqfma2760 fma 1e-6069 1e-101 0e+6144 -> 1E-6170 Subnormal dqfma2761 fma 1e-6069 1e-102 0e+6144 -> 1E-6171 Subnormal dqfma2762 fma 1e-6069 1e-103 0e+6144 -> 1E-6172 Subnormal diff --git a/Lib/test/decimaltestdata/dqMultiply.decTest b/Lib/test/decimaltestdata/dqMultiply.decTest index 676c1f5ea44..f9df480bb2a 100644 --- a/Lib/test/decimaltestdata/dqMultiply.decTest +++ b/Lib/test/decimaltestdata/dqMultiply.decTest @@ -355,7 +355,7 @@ dqmul756 multiply 1e-4277 -1e-3311 -> -0E-6176 Underflow Subnormal Inexact Roun dqmul757 multiply -1e-4277 1e-3311 -> -0E-6176 Underflow Subnormal Inexact Rounded Clamped dqmul758 multiply -1e-4277 -1e-3311 -> 0E-6176 Underflow Subnormal Inexact Rounded Clamped --- 'subnormal' boundary (all hard underflow or overflow in base arithemtic) +-- 'subnormal' boundary (all hard underflow or overflow in base arithmetic) dqmul760 multiply 1e-6069 1e-101 -> 1E-6170 Subnormal dqmul761 multiply 1e-6069 1e-102 -> 1E-6171 Subnormal dqmul762 multiply 1e-6069 1e-103 -> 1E-6172 Subnormal diff --git a/Lib/test/decimaltestdata/fma.decTest b/Lib/test/decimaltestdata/fma.decTest index 0b188fa4c30..46672af3928 100644 --- a/Lib/test/decimaltestdata/fma.decTest +++ b/Lib/test/decimaltestdata/fma.decTest @@ -25,7 +25,7 @@ rounding: half_up maxExponent: 384 minexponent: -383 --- These tests comprese three parts: +-- These tests comprise three parts: -- 1. Sanity checks and other three-operand tests (especially those -- where the fused operation makes a difference) -- 2. Multiply tests (third operand is neutral zero [0E+emax]) @@ -610,7 +610,7 @@ fmax2756 fma 1e-777777 -1e-411111 0E+999999 -> -0E-1000007 Underflow Subnorma fmax2757 fma -1e-777777 1e-411111 0E+999999 -> -0E-1000007 Underflow Subnormal Inexact Rounded Clamped fmax2758 fma -1e-777777 -1e-411111 0E+999999 -> 0E-1000007 Underflow Subnormal Inexact Rounded Clamped --- 'subnormal' boundary (all hard underflow or overflow in base arithemtic) +-- 'subnormal' boundary (all hard underflow or overflow in base arithmetic) precision: 9 fmax2760 fma 1e-600000 1e-400001 0E+999999 -> 1E-1000001 Subnormal fmax2761 fma 1e-600000 1e-400002 0E+999999 -> 1E-1000002 Subnormal diff --git a/Lib/test/decimaltestdata/multiply.decTest b/Lib/test/decimaltestdata/multiply.decTest index e8bd77a87c3..f291538b7da 100644 --- a/Lib/test/decimaltestdata/multiply.decTest +++ b/Lib/test/decimaltestdata/multiply.decTest @@ -533,7 +533,7 @@ mulx756 multiply 1e-777777777 -1e-411111111 -> -0E-1000000007 Underflow Subnorm mulx757 multiply -1e-777777777 1e-411111111 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped mulx758 multiply -1e-777777777 -1e-411111111 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped --- 'subnormal' boundary (all hard underflow or overflow in base arithemtic) +-- 'subnormal' boundary (all hard underflow or overflow in base arithmetic) precision: 9 mulx760 multiply 1e-600000000 1e-400000001 -> 1E-1000000001 Subnormal mulx761 multiply 1e-600000000 1e-400000002 -> 1E-1000000002 Subnormal diff --git a/Lib/test/test_binop.py b/Lib/test/test_binop.py index 4f5b8a8b93e..299af09c498 100644 --- a/Lib/test/test_binop.py +++ b/Lib/test/test_binop.py @@ -22,7 +22,7 @@ def isnum(x): return 0 def isRat(x): - """Test wheter an object is an instance of the Rat class.""" + """Test whether an object is an instance of the Rat class.""" return isinstance(x, Rat) class Rat(object): diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py index 8eede7a6849..3acfb92be4a 100644 --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -1253,7 +1253,7 @@ def f(x, y): self.assertEqual(mock_int.__hash__.call_count, 2) self.assertEqual(f.cache_info(), (1, 1, 1, 1)) - # Cache eviction: No use as an argument gives no additonal call + # Cache eviction: No use as an argument gives no additional call self.assertEqual(f(6, 2), 20) self.assertEqual(mock_int.__hash__.call_count, 2) self.assertEqual(f.cache_info(), (1, 2, 1, 1)) diff --git a/Lib/test/test_importlib/import_/test___package__.py b/Lib/test/test_importlib/import_/test___package__.py index b26634ea453..761b256b387 100644 --- a/Lib/test/test_importlib/import_/test___package__.py +++ b/Lib/test/test_importlib/import_/test___package__.py @@ -11,7 +11,7 @@ class Using__package__: - """Use of __package__ supercedes the use of __name__/__path__ to calculate + """Use of __package__ supersedes the use of __name__/__path__ to calculate what package a module belongs to. The basic algorithm is [__package__]:: def resolve_name(name, package, level): diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 611692f7644..234f701a115 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1598,19 +1598,19 @@ def test_internal_execvpe_str(self): def test_execve_invalid_env(self): args = [sys.executable, '-c', 'pass'] - # null character in the enviroment variable name + # null character in the environment variable name newenv = os.environ.copy() newenv["FRUIT\0VEGETABLE"] = "cabbage" with self.assertRaises(ValueError): os.execve(args[0], args, newenv) - # null character in the enviroment variable value + # null character in the environment variable value newenv = os.environ.copy() newenv["FRUIT"] = "orange\0VEGETABLE=cabbage" with self.assertRaises(ValueError): os.execve(args[0], args, newenv) - # equal character in the enviroment variable name + # equal character in the environment variable name newenv = os.environ.copy() newenv["FRUIT=ORANGE"] = "lemon" with self.assertRaises(ValueError): @@ -2430,7 +2430,7 @@ def test_spawnve_noargs(self): def _test_invalid_env(self, spawn): args = [sys.executable, '-c', 'pass'] - # null character in the enviroment variable name + # null character in the environment variable name newenv = os.environ.copy() newenv["FRUIT\0VEGETABLE"] = "cabbage" try: @@ -2440,7 +2440,7 @@ def _test_invalid_env(self, spawn): else: self.assertEqual(exitcode, 127) - # null character in the enviroment variable value + # null character in the environment variable value newenv = os.environ.copy() newenv["FRUIT"] = "orange\0VEGETABLE=cabbage" try: @@ -2450,7 +2450,7 @@ def _test_invalid_env(self, spawn): else: self.assertEqual(exitcode, 127) - # equal character in the enviroment variable name + # equal character in the environment variable name newenv = os.environ.copy() newenv["FRUIT=ORANGE"] = "lemon" try: @@ -2460,7 +2460,7 @@ def _test_invalid_env(self, spawn): else: self.assertEqual(exitcode, 127) - # equal character in the enviroment variable value + # equal character in the environment variable value filename = support.TESTFN self.addCleanup(support.unlink, filename) with open(filename, "w") as fp: diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index a99976aa56f..d152826213e 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -668,25 +668,25 @@ def test_invalid_cmd(self): subprocess.Popen([sys.executable, "-c", "pass#\0"]) def test_invalid_env(self): - # null character in the enviroment variable name + # null character in the environment variable name newenv = os.environ.copy() newenv["FRUIT\0VEGETABLE"] = "cabbage" with self.assertRaises(ValueError): subprocess.Popen([sys.executable, "-c", "pass"], env=newenv) - # null character in the enviroment variable value + # null character in the environment variable value newenv = os.environ.copy() newenv["FRUIT"] = "orange\0VEGETABLE=cabbage" with self.assertRaises(ValueError): subprocess.Popen([sys.executable, "-c", "pass"], env=newenv) - # equal character in the enviroment variable name + # equal character in the environment variable name newenv = os.environ.copy() newenv["FRUIT=ORANGE"] = "lemon" with self.assertRaises(ValueError): subprocess.Popen([sys.executable, "-c", "pass"], env=newenv) - # equal character in the enviroment variable value + # equal character in the environment variable value newenv = os.environ.copy() newenv["FRUIT"] = "orange=lemon" with subprocess.Popen([sys.executable, "-c", diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py index 3481e9cb968..69623c40f46 100644 --- a/Lib/test/test_warnings/__init__.py +++ b/Lib/test/test_warnings/__init__.py @@ -950,7 +950,7 @@ def test_catch_warnings_defaults(self): self.assertIs(wmod.filters, orig_filters) def test_record_override_showwarning_before(self): - # Issue #28835: If warnings.showwarning() was overriden, make sure + # Issue #28835: If warnings.showwarning() was overridden, make sure # that catch_warnings(record=True) overrides it again. text = "This is a warning" wmod = self.module diff --git a/Lib/unittest/test/testmock/testmagicmethods.py b/Lib/unittest/test/testmock/testmagicmethods.py index 24569b532de..7993db33893 100644 --- a/Lib/unittest/test/testmock/testmagicmethods.py +++ b/Lib/unittest/test/testmock/testmagicmethods.py @@ -255,7 +255,7 @@ def test_magicmock(self): for entry in _magics: self.assertTrue(hasattr(mock, entry)) - self.assertFalse(hasattr(mock, '__imaginery__')) + self.assertFalse(hasattr(mock, '__imaginary__')) def test_magic_mock_equality(self): diff --git a/Misc/HISTORY b/Misc/HISTORY index 4ce431f660e..4872cfce80b 100644 --- a/Misc/HISTORY +++ b/Misc/HISTORY @@ -1597,7 +1597,7 @@ Library negative values the same way for keyword arguments as it does for positional arguments. -- Issue #21812: turtle.shapetransform did not tranform the turtle on the +- Issue #21812: turtle.shapetransform did not transform the turtle on the first call. (Issue identified and fixed by Lita Cho.) - Issue #21635: The difflib SequenceMatcher.get_matching_blocks() method @@ -3245,7 +3245,7 @@ Core and Builtins - Issue #19466: Clear the frames of daemon threads earlier during the Python shutdown to call objects destructors. So "unclosed file" resource - warnings are now corretly emitted for daemon threads. + warnings are now correctly emitted for daemon threads. - Issue #19514: Deduplicate some _Py_IDENTIFIER declarations. Patch by Andrei Dorian Duma. @@ -3386,7 +3386,7 @@ Library - Issue #19448: Add private API to SSL module to lookup ASN.1 objects by OID, NID, short name and long name. -- Issue #19282: dbm.open now supports the context management protocol. (Inital +- Issue #19282: dbm.open now supports the context management protocol. (Initial patch by Claudiu Popa) - Issue #8311: Added support for writing any bytes-like objects in the aifc, @@ -3481,7 +3481,7 @@ Library - Issue #19227: Remove pthread_atfork() handler. The handler was added to solve #18747 but has caused issues. -- Issue #19420: Fix reference leak in module initalization code of +- Issue #19420: Fix reference leak in module initialization code of _hashopenssl.c - Issue #19329: Optimized compiling charsets in regular expressions. @@ -4175,7 +4175,7 @@ Library - Issue #18709: Fix CVE-2013-4238. The SSL module now handles NULL bytes inside subjectAltName correctly. Formerly the module has used OpenSSL's - GENERAL_NAME_print() function to get the string represention of ASN.1 + GENERAL_NAME_print() function to get the string representation of ASN.1 strings for ``rfc822Name`` (email), ``dNSName`` (DNS) and ``uniformResourceIdentifier`` (URI). @@ -4268,7 +4268,7 @@ IDLE Documentation ------------- -- Issue #18743: Fix references to non-existant "StringIO" module. +- Issue #18743: Fix references to non-existent "StringIO" module. - Issue #18783: Removed existing mentions of Python long type in docstrings, error messages and comments. @@ -5022,7 +5022,7 @@ Library Thomas Barlow. - Issue #17358: Modules loaded by imp.load_source() and load_compiled() (and by - extention load_module()) now have a better chance of working when reloaded. + extension load_module()) now have a better chance of working when reloaded. - Issue #17804: New function ``struct.iter_unpack`` allows for streaming struct unpacking. @@ -5135,8 +5135,8 @@ Library error message has been removed. Patch by Ram Rachum. - Issue #18080: When building a C extension module on OS X, if the compiler - is overriden with the CC environment variable, use the new compiler as - the default for linking if LDSHARED is not also overriden. This restores + is overridden with the CC environment variable, use the new compiler as + the default for linking if LDSHARED is not also overridden. This restores Distutils behavior introduced in 3.2.3 and inadvertently dropped in 3.3.0. - Issue #18113: Fixed a refcount leak in the curses.panel module's @@ -5207,7 +5207,7 @@ Library specifically addresses a stack misalignment issue on x86 and issues on some more recent platforms. -- Issue #8862: Fixed curses cleanup when getkey is interrputed by a signal. +- Issue #8862: Fixed curses cleanup when getkey is interrupted by a signal. - Issue #17443: imaplib.IMAP4_stream was using the default unbuffered IO in subprocess, but the imap code assumes buffered IO. In Python2 this @@ -5382,7 +5382,7 @@ Library internal XML encoding is not UTF-8 or US-ASCII. It also now accepts bytes and strings larger than 2 GiB. -- Issue #6083: Fix multiple segmentation faults occured when PyArg_ParseTuple +- Issue #6083: Fix multiple segmentation faults occurred when PyArg_ParseTuple parses nested mutating sequence. - Issue #5289: Fix ctypes.util.find_library on Solaris. @@ -26790,7 +26790,7 @@ using sre (without changes to the re API). filecmp - supersedes the old cmp.py and dircmp.py modules. -tabnanny - check Python sources for tab-width dependance. (Moved from +tabnanny - check Python sources for tab-width dependence. (Moved from Tools/scripts/.) urllib2 - new and improved but incompatible version of urllib (still diff --git a/Misc/NEWS b/Misc/NEWS index 38449c0409f..1ef28927266 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -454,7 +454,7 @@ Library Rodola'. - bpo-30595: multiprocessing.Queue.get() with a timeout now polls its reader in - non-blocking mode if it succeeded to aquire the lock but the acquire took + non-blocking mode if it succeeded to acquire the lock but the acquire took longer than the timeout. - bpo-28556: Updates to typing module: Add generic AsyncContextManager, add @@ -892,7 +892,7 @@ Library re.sub() replacement templates regular expressions now are errors. - Issue #28835: Fix a regression introduced in warnings.catch_warnings(): - call warnings.showwarning() if it was overriden inside the context manager. + call warnings.showwarning() if it was overridden inside the context manager. - Issue #27172: To assist with upgrades from 2.7, the previously documented deprecation of ``inspect.getfullargspec()`` has been reversed. This decision @@ -1680,7 +1680,7 @@ Library again. But they still are deprecated and will be disabled in 3.7. - Issue #28835: Fix a regression introduced in warnings.catch_warnings(): - call warnings.showwarning() if it was overriden inside the context manager. + call warnings.showwarning() if it was overridden inside the context manager. - Issue #27172: To assist with upgrades from 2.7, the previously documented deprecation of ``inspect.getfullargspec()`` has been reversed. This decision diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index fc953af5184..fe39567374d 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -3670,7 +3670,7 @@ _build_callargs(PyCFuncPtrObject *self, PyObject *argtypes, */ if (ob == NULL) goto error; - /* The .from_param call that will ocurr later will pass this + /* The .from_param call that will occur later will pass this as a byref parameter. */ PyTuple_SET_ITEM(callargs, i, ob); *poutmask |= (1 << i); /* mark as out arg */ diff --git a/Modules/_lzmamodule.c b/Modules/_lzmamodule.c index bb77552b67b..26bfa0b4ebb 100644 --- a/Modules/_lzmamodule.c +++ b/Modules/_lzmamodule.c @@ -824,7 +824,7 @@ PyDoc_STRVAR(Compressor_doc, "be FORMAT_XZ (default), FORMAT_ALONE, or FORMAT_RAW.\n" "\n" "check specifies the integrity check to use. For FORMAT_XZ, the default\n" -"is CHECK_CRC64. FORMAT_ALONE and FORMAT_RAW do not suport integrity\n" +"is CHECK_CRC64. FORMAT_ALONE and FORMAT_RAW do not support integrity\n" "checks; for these formats, check must be omitted, or be CHECK_NONE.\n" "\n" "The settings used by the compressor can be specified either as a\n" diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 0c6723fb09f..2e5e79a8d36 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -1038,7 +1038,7 @@ path_converter(PyObject *o, void *p) } else if (is_buffer) { /* XXX Replace PyObject_CheckBuffer with PyBytes_Check in other code - after removing suport of non-bytes buffer objects. */ + after removing support of non-bytes buffer objects. */ if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, "%s%s%s should be %s, not %.200s", path->function_name ? path->function_name : "", diff --git a/Python/ceval.c b/Python/ceval.c index dd90e18a855..be5cda58cda 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3313,7 +3313,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) ^- (-oparg-1) ^- (-oparg-2) - `callable` will be POPed by call_funtion. + `callable` will be POPed by call_function. NULL will will be POPed manually later. */ res = call_function(&sp, oparg, NULL); From webhook-mailer at python.org Thu Aug 3 04:37:20 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Thu, 03 Aug 2017 08:37:20 -0000 Subject: [Python-checkins] bpo-31071: Avoid masking original TypeError in call with * unpacking (#2957) Message-ID: https://github.com/python/cpython/commit/25e4f779d7ae9f37a1933cb5cbfad06e673c01f9 commit: 25e4f779d7ae9f37a1933cb5cbfad06e673c01f9 branch: master author: Serhiy Storchaka committer: GitHub date: 2017-08-03T11:37:15+03:00 summary: bpo-31071: Avoid masking original TypeError in call with * unpacking (#2957) when other arguments are passed. files: A Misc/NEWS.d/next/Core and Builtins/2017-07-31-13-28-53.bpo-31071.P9UBDy.rst M Lib/test/test_extcall.py M Python/ceval.c diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py index 043df013112..2c1848337b2 100644 --- a/Lib/test/test_extcall.py +++ b/Lib/test/test_extcall.py @@ -163,6 +163,10 @@ Traceback (most recent call last): ... TypeError: myerror + >>> g(*range(1), *(broken() for i in range(1))) + Traceback (most recent call last): + ... + TypeError: myerror >>> class BrokenIterable1: ... def __iter__(self): @@ -172,6 +176,10 @@ Traceback (most recent call last): ... TypeError: myerror + >>> g(*range(1), *BrokenIterable1()) + Traceback (most recent call last): + ... + TypeError: myerror >>> class BrokenIterable2: ... def __iter__(self): @@ -182,6 +190,10 @@ Traceback (most recent call last): ... TypeError: myerror + >>> g(*range(1), *BrokenIterable2()) + Traceback (most recent call last): + ... + TypeError: myerror >>> class BrokenSequence: ... def __getitem__(self, idx): @@ -191,6 +203,10 @@ Traceback (most recent call last): ... TypeError: myerror + >>> g(*range(1), *BrokenSequence()) + Traceback (most recent call last): + ... + TypeError: myerror Make sure that the function doesn't stomp the dictionary diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-07-31-13-28-53.bpo-31071.P9UBDy.rst b/Misc/NEWS.d/next/Core and Builtins/2017-07-31-13-28-53.bpo-31071.P9UBDy.rst new file mode 100644 index 00000000000..c34d4751bfa --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-07-31-13-28-53.bpo-31071.P9UBDy.rst @@ -0,0 +1,2 @@ +Avoid masking original TypeError in call with * unpacking when other +arguments are passed. diff --git a/Python/ceval.c b/Python/ceval.c index be5cda58cda..9f732f56ba8 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -66,6 +66,8 @@ static void format_exc_unbound(PyCodeObject *co, int oparg); static PyObject * unicode_concatenate(PyObject *, PyObject *, PyFrameObject *, const _Py_CODEUNIT *); static PyObject * special_lookup(PyObject *, _Py_Identifier *); +static int check_args_iterable(PyObject *func, PyObject *vararg); +static void format_kwargs_mapping_error(PyObject *func, PyObject *kwargs); #define NAME_ERROR_MSG \ "name '%.200s' is not defined" @@ -2512,14 +2514,9 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) none_val = _PyList_Extend((PyListObject *)sum, PEEK(i)); if (none_val == NULL) { if (opcode == BUILD_TUPLE_UNPACK_WITH_CALL && - PyErr_ExceptionMatches(PyExc_TypeError)) { - PyObject *func = PEEK(1 + oparg); - PyErr_Format(PyExc_TypeError, - "%.200s%.200s argument after * " - "must be an iterable, not %.200s", - PyEval_GetFuncName(func), - PyEval_GetFuncDesc(func), - PEEK(i)->ob_type->tp_name); + PyErr_ExceptionMatches(PyExc_TypeError)) + { + check_args_iterable(PEEK(1 + oparg), PEEK(i)); } Py_DECREF(sum); goto error; @@ -2732,12 +2729,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) if (_PyDict_MergeEx(sum, arg, 2) < 0) { PyObject *func = PEEK(2 + oparg); if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_TypeError, - "%.200s%.200s argument after ** " - "must be a mapping, not %.200s", - PyEval_GetFuncName(func), - PyEval_GetFuncDesc(func), - arg->ob_type->tp_name); + format_kwargs_mapping_error(func, arg); } else if (PyErr_ExceptionMatches(PyExc_KeyError)) { PyObject *exc, *val, *tb; @@ -3390,13 +3382,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) * is not a mapping. */ if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - func = SECOND(); - PyErr_Format(PyExc_TypeError, - "%.200s%.200s argument after ** " - "must be a mapping, not %.200s", - PyEval_GetFuncName(func), - PyEval_GetFuncDesc(func), - kwargs->ob_type->tp_name); + format_kwargs_mapping_error(SECOND(), kwargs); } Py_DECREF(kwargs); goto error; @@ -3409,14 +3395,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) callargs = POP(); func = TOP(); if (!PyTuple_CheckExact(callargs)) { - if (Py_TYPE(callargs)->tp_iter == NULL && - !PySequence_Check(callargs)) { - PyErr_Format(PyExc_TypeError, - "%.200s%.200s argument after * " - "must be an iterable, not %.200s", - PyEval_GetFuncName(func), - PyEval_GetFuncDesc(func), - callargs->ob_type->tp_name); + if (check_args_iterable(func, callargs) < 0) { Py_DECREF(callargs); goto error; } @@ -5179,6 +5158,32 @@ import_all_from(PyObject *locals, PyObject *v) return err; } +static int +check_args_iterable(PyObject *func, PyObject *args) +{ + if (args->ob_type->tp_iter == NULL && !PySequence_Check(args)) { + PyErr_Format(PyExc_TypeError, + "%.200s%.200s argument after * " + "must be an iterable, not %.200s", + PyEval_GetFuncName(func), + PyEval_GetFuncDesc(func), + args->ob_type->tp_name); + return -1; + } + return 0; +} + +static void +format_kwargs_mapping_error(PyObject *func, PyObject *kwargs) +{ + PyErr_Format(PyExc_TypeError, + "%.200s%.200s argument after ** " + "must be a mapping, not %.200s", + PyEval_GetFuncName(func), + PyEval_GetFuncDesc(func), + kwargs->ob_type->tp_name); +} + static void format_exc_check_arg(PyObject *exc, const char *format_str, PyObject *obj) { From webhook-mailer at python.org Thu Aug 3 04:45:29 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Thu, 03 Aug 2017 08:45:29 -0000 Subject: [Python-checkins] bpo-30978: str.format_map() now passes key lookup exceptions through. (#2790) Message-ID: https://github.com/python/cpython/commit/5075416b8fedc5526b643dabc915f7945fa0d969 commit: 5075416b8fedc5526b643dabc915f7945fa0d969 branch: master author: Serhiy Storchaka committer: GitHub date: 2017-08-03T11:45:23+03:00 summary: bpo-30978: str.format_map() now passes key lookup exceptions through. (#2790) Previously any exception was replaced with a KeyError exception. files: A Misc/NEWS.d/next/Core and Builtins/2017-07-21-07-39-05.bpo-30978.f0jODc.rst M Lib/test/test_re.py M Lib/test/test_unicode.py M Objects/stringlib/unicode_format.h diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index 0ea5a204696..e9c07a04f57 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -468,7 +468,7 @@ def test_match_getitem(self): m[(0,)] with self.assertRaisesRegex(IndexError, 'no such group'): m[(0, 1)] - with self.assertRaisesRegex(KeyError, 'a2'): + with self.assertRaisesRegex(IndexError, 'no such group'): 'a1={a2}'.format_map(m) m = pat.match('ac') diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 506f0715c2e..341007b6507 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -1278,6 +1278,13 @@ def __format__(self, spec): self.assertRaises(ValueError, '{}'.format_map, 'a') self.assertRaises(ValueError, '{a} {}'.format_map, {"a" : 2, "b" : 1}) + class BadMapping: + def __getitem__(self, key): + return 1/0 + self.assertRaises(KeyError, '{a}'.format_map, {}) + self.assertRaises(TypeError, '{a}'.format_map, []) + self.assertRaises(ZeroDivisionError, '{a}'.format_map, BadMapping()) + def test_format_huge_precision(self): format_string = ".{}f".format(sys.maxsize + 1) with self.assertRaises(ValueError): diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-07-21-07-39-05.bpo-30978.f0jODc.rst b/Misc/NEWS.d/next/Core and Builtins/2017-07-21-07-39-05.bpo-30978.f0jODc.rst new file mode 100644 index 00000000000..bb67a9fb244 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-07-21-07-39-05.bpo-30978.f0jODc.rst @@ -0,0 +1,2 @@ +str.format_map() now passes key lookup exceptions through. +Previously any exception was replaced with a KeyError exception. diff --git a/Objects/stringlib/unicode_format.h b/Objects/stringlib/unicode_format.h index 7ac0d75166b..baaac811a56 100644 --- a/Objects/stringlib/unicode_format.h +++ b/Objects/stringlib/unicode_format.h @@ -410,18 +410,22 @@ get_field_object(SubString *input, PyObject *args, PyObject *kwargs, if (index == -1) { /* look up in kwargs */ PyObject *key = SubString_new_object(&first); - if (key == NULL) + if (key == NULL) { goto error; - - /* Use PyObject_GetItem instead of PyDict_GetItem because this - code is no longer just used with kwargs. It might be passed - a non-dict when called through format_map. */ - if ((kwargs == NULL) || (obj = PyObject_GetItem(kwargs, key)) == NULL) { + } + if (kwargs == NULL) { PyErr_SetObject(PyExc_KeyError, key); Py_DECREF(key); goto error; } + /* Use PyObject_GetItem instead of PyDict_GetItem because this + code is no longer just used with kwargs. It might be passed + a non-dict when called through format_map. */ + obj = PyObject_GetItem(kwargs, key); Py_DECREF(key); + if (obj == NULL) { + goto error; + } } else { /* If args is NULL, we have a format string with a positional field From solipsis at pitrou.net Thu Aug 3 05:10:35 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 03 Aug 2017 09:10:35 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=-1 Message-ID: <20170803091033.16390.AEA4F908ECB0A4A4@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [0, 0, -7] memory blocks, sum=-7 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [1, 2, -1] memory blocks, sum=2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogWyi5iP', '--timeout', '7200'] From webhook-mailer at python.org Thu Aug 3 05:14:11 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Thu, 03 Aug 2017 09:14:11 -0000 Subject: [Python-checkins] [3.6] bpo-30978: str.format_map() now passes key lookup exceptions through. (GH-2790) (#2992) Message-ID: https://github.com/python/cpython/commit/f08b2be4416163e3d18b8d09891e7cda0d8a21d4 commit: f08b2be4416163e3d18b8d09891e7cda0d8a21d4 branch: 3.6 author: Serhiy Storchaka committer: GitHub date: 2017-08-03T12:14:07+03:00 summary: [3.6] bpo-30978: str.format_map() now passes key lookup exceptions through. (GH-2790) (#2992) Previously any exception was replaced with a KeyError exception. (cherry picked from commit 5075416) files: A Misc/NEWS.d/next/Core and Builtins/2017-07-21-07-39-05.bpo-30978.f0jODc.rst M Lib/test/test_re.py M Lib/test/test_unicode.py M Objects/stringlib/unicode_format.h diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index a6cbbd0b67a..e23e5a9a6ca 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -471,7 +471,7 @@ def test_match_getitem(self): m[(0,)] with self.assertRaisesRegex(IndexError, 'no such group'): m[(0, 1)] - with self.assertRaisesRegex(KeyError, 'a2'): + with self.assertRaisesRegex(IndexError, 'no such group'): 'a1={a2}'.format_map(m) m = pat.match('ac') diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 2844bc5540c..56ab0ad7329 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -1279,6 +1279,13 @@ def __format__(self, spec): self.assertRaises(ValueError, '{}'.format_map, 'a') self.assertRaises(ValueError, '{a} {}'.format_map, {"a" : 2, "b" : 1}) + class BadMapping: + def __getitem__(self, key): + return 1/0 + self.assertRaises(KeyError, '{a}'.format_map, {}) + self.assertRaises(TypeError, '{a}'.format_map, []) + self.assertRaises(ZeroDivisionError, '{a}'.format_map, BadMapping()) + def test_format_huge_precision(self): format_string = ".{}f".format(sys.maxsize + 1) with self.assertRaises(ValueError): diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-07-21-07-39-05.bpo-30978.f0jODc.rst b/Misc/NEWS.d/next/Core and Builtins/2017-07-21-07-39-05.bpo-30978.f0jODc.rst new file mode 100644 index 00000000000..bb67a9fb244 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-07-21-07-39-05.bpo-30978.f0jODc.rst @@ -0,0 +1,2 @@ +str.format_map() now passes key lookup exceptions through. +Previously any exception was replaced with a KeyError exception. diff --git a/Objects/stringlib/unicode_format.h b/Objects/stringlib/unicode_format.h index 14fa28ea54a..7314af02a4a 100644 --- a/Objects/stringlib/unicode_format.h +++ b/Objects/stringlib/unicode_format.h @@ -412,18 +412,22 @@ get_field_object(SubString *input, PyObject *args, PyObject *kwargs, if (index == -1) { /* look up in kwargs */ PyObject *key = SubString_new_object(&first); - if (key == NULL) + if (key == NULL) { goto error; - - /* Use PyObject_GetItem instead of PyDict_GetItem because this - code is no longer just used with kwargs. It might be passed - a non-dict when called through format_map. */ - if ((kwargs == NULL) || (obj = PyObject_GetItem(kwargs, key)) == NULL) { + } + if (kwargs == NULL) { PyErr_SetObject(PyExc_KeyError, key); Py_DECREF(key); goto error; } + /* Use PyObject_GetItem instead of PyDict_GetItem because this + code is no longer just used with kwargs. It might be passed + a non-dict when called through format_map. */ + obj = PyObject_GetItem(kwargs, key); Py_DECREF(key); + if (obj == NULL) { + goto error; + } } else { /* If args is NULL, we have a format string with a positional field From webhook-mailer at python.org Thu Aug 3 05:14:38 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Thu, 03 Aug 2017 09:14:38 -0000 Subject: [Python-checkins] [3.6] bpo-31071: Avoid masking original TypeError in call with * unpacking (GH-2957) (#2991) Message-ID: https://github.com/python/cpython/commit/946a0b69e217ff22a6c056047eab42053e9a2d5f commit: 946a0b69e217ff22a6c056047eab42053e9a2d5f branch: 3.6 author: Serhiy Storchaka committer: GitHub date: 2017-08-03T12:14:35+03:00 summary: [3.6] bpo-31071: Avoid masking original TypeError in call with * unpacking (GH-2957) (#2991) when other arguments are passed. (cherry picked from commit 25e4f77) files: A Misc/NEWS.d/next/Core and Builtins/2017-07-31-13-28-53.bpo-31071.P9UBDy.rst M Lib/test/test_extcall.py M Python/ceval.c diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py index 043df013112..2c1848337b2 100644 --- a/Lib/test/test_extcall.py +++ b/Lib/test/test_extcall.py @@ -163,6 +163,10 @@ Traceback (most recent call last): ... TypeError: myerror + >>> g(*range(1), *(broken() for i in range(1))) + Traceback (most recent call last): + ... + TypeError: myerror >>> class BrokenIterable1: ... def __iter__(self): @@ -172,6 +176,10 @@ Traceback (most recent call last): ... TypeError: myerror + >>> g(*range(1), *BrokenIterable1()) + Traceback (most recent call last): + ... + TypeError: myerror >>> class BrokenIterable2: ... def __iter__(self): @@ -182,6 +190,10 @@ Traceback (most recent call last): ... TypeError: myerror + >>> g(*range(1), *BrokenIterable2()) + Traceback (most recent call last): + ... + TypeError: myerror >>> class BrokenSequence: ... def __getitem__(self, idx): @@ -191,6 +203,10 @@ Traceback (most recent call last): ... TypeError: myerror + >>> g(*range(1), *BrokenSequence()) + Traceback (most recent call last): + ... + TypeError: myerror Make sure that the function doesn't stomp the dictionary diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-07-31-13-28-53.bpo-31071.P9UBDy.rst b/Misc/NEWS.d/next/Core and Builtins/2017-07-31-13-28-53.bpo-31071.P9UBDy.rst new file mode 100644 index 00000000000..c34d4751bfa --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-07-31-13-28-53.bpo-31071.P9UBDy.rst @@ -0,0 +1,2 @@ +Avoid masking original TypeError in call with * unpacking when other +arguments are passed. diff --git a/Python/ceval.c b/Python/ceval.c index 770dfcba89e..8eb78bf4d46 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -64,6 +64,8 @@ static void format_exc_unbound(PyCodeObject *co, int oparg); static PyObject * unicode_concatenate(PyObject *, PyObject *, PyFrameObject *, const _Py_CODEUNIT *); static PyObject * special_lookup(PyObject *, _Py_Identifier *); +static int check_args_iterable(PyObject *func, PyObject *vararg); +static void format_kwargs_mapping_error(PyObject *func, PyObject *kwargs); #define NAME_ERROR_MSG \ "name '%.200s' is not defined" @@ -2578,14 +2580,9 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) none_val = _PyList_Extend((PyListObject *)sum, PEEK(i)); if (none_val == NULL) { if (opcode == BUILD_TUPLE_UNPACK_WITH_CALL && - PyErr_ExceptionMatches(PyExc_TypeError)) { - PyObject *func = PEEK(1 + oparg); - PyErr_Format(PyExc_TypeError, - "%.200s%.200s argument after * " - "must be an iterable, not %.200s", - PyEval_GetFuncName(func), - PyEval_GetFuncDesc(func), - PEEK(i)->ob_type->tp_name); + PyErr_ExceptionMatches(PyExc_TypeError)) + { + check_args_iterable(PEEK(1 + oparg), PEEK(i)); } Py_DECREF(sum); goto error; @@ -2798,12 +2795,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) if (_PyDict_MergeEx(sum, arg, 2) < 0) { PyObject *func = PEEK(2 + oparg); if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_TypeError, - "%.200s%.200s argument after ** " - "must be a mapping, not %.200s", - PyEval_GetFuncName(func), - PyEval_GetFuncDesc(func), - arg->ob_type->tp_name); + format_kwargs_mapping_error(func, arg); } else if (PyErr_ExceptionMatches(PyExc_KeyError)) { PyObject *exc, *val, *tb; @@ -3370,13 +3362,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) * is not a mapping. */ if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - func = SECOND(); - PyErr_Format(PyExc_TypeError, - "%.200s%.200s argument after ** " - "must be a mapping, not %.200s", - PyEval_GetFuncName(func), - PyEval_GetFuncDesc(func), - kwargs->ob_type->tp_name); + format_kwargs_mapping_error(SECOND(), kwargs); } Py_DECREF(kwargs); goto error; @@ -3389,14 +3375,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) callargs = POP(); func = TOP(); if (!PyTuple_CheckExact(callargs)) { - if (Py_TYPE(callargs)->tp_iter == NULL && - !PySequence_Check(callargs)) { - PyErr_Format(PyExc_TypeError, - "%.200s%.200s argument after * " - "must be an iterable, not %.200s", - PyEval_GetFuncName(func), - PyEval_GetFuncDesc(func), - callargs->ob_type->tp_name); + if (check_args_iterable(func, callargs) < 0) { Py_DECREF(callargs); goto error; } @@ -5351,6 +5330,32 @@ import_all_from(PyObject *locals, PyObject *v) return err; } +static int +check_args_iterable(PyObject *func, PyObject *args) +{ + if (args->ob_type->tp_iter == NULL && !PySequence_Check(args)) { + PyErr_Format(PyExc_TypeError, + "%.200s%.200s argument after * " + "must be an iterable, not %.200s", + PyEval_GetFuncName(func), + PyEval_GetFuncDesc(func), + args->ob_type->tp_name); + return -1; + } + return 0; +} + +static void +format_kwargs_mapping_error(PyObject *func, PyObject *kwargs) +{ + PyErr_Format(PyExc_TypeError, + "%.200s%.200s argument after ** " + "must be a mapping, not %.200s", + PyEval_GetFuncName(func), + PyEval_GetFuncDesc(func), + kwargs->ob_type->tp_name); +} + static void format_exc_check_arg(PyObject *exc, const char *format_str, PyObject *obj) { From webhook-mailer at python.org Thu Aug 3 10:20:46 2017 From: webhook-mailer at python.org (Mariatta) Date: Thu, 03 Aug 2017 14:20:46 -0000 Subject: [Python-checkins] Improve grammar in asyncio documentation (GH-2993) Message-ID: https://github.com/python/cpython/commit/87c3c5de731af18a271f4559cd69ccb8d050208f commit: 87c3c5de731af18a271f4559cd69ccb8d050208f branch: master author: Mike DePalatis committer: Mariatta date: 2017-08-04T00:20:42+10:00 summary: Improve grammar in asyncio documentation (GH-2993) "not only is it .." is the correct form, as opposed to: "not only it is ..." files: M Doc/library/asyncio-dev.rst diff --git a/Doc/library/asyncio-dev.rst b/Doc/library/asyncio-dev.rst index cc4a14b2016..1838eb95a7d 100644 --- a/Doc/library/asyncio-dev.rst +++ b/Doc/library/asyncio-dev.rst @@ -52,7 +52,7 @@ Cancellation ------------ Cancellation of tasks is not common in classic programming. In asynchronous -programming, not only it is something common, but you have to prepare your +programming, not only is it something common, but you have to prepare your code to handle it. Futures and tasks can be cancelled explicitly with their :meth:`Future.cancel` From webhook-mailer at python.org Thu Aug 3 10:33:37 2017 From: webhook-mailer at python.org (Mariatta) Date: Thu, 03 Aug 2017 14:33:37 -0000 Subject: [Python-checkins] [3.6] Improve grammar in asyncio documentation (GH-2993) (GH-2994) Message-ID: https://github.com/python/cpython/commit/9b3abacf87653fab707e83b31afd73ac4140228e commit: 9b3abacf87653fab707e83b31afd73ac4140228e branch: 3.6 author: Mariatta committer: GitHub date: 2017-08-04T00:33:33+10:00 summary: [3.6] Improve grammar in asyncio documentation (GH-2993) (GH-2994) "not only is it .." is the correct form, as opposed to: "not only it is ..." (cherry picked from commit 87c3c5de731af18a271f4559cd69ccb8d050208f) files: M Doc/library/asyncio-dev.rst diff --git a/Doc/library/asyncio-dev.rst b/Doc/library/asyncio-dev.rst index cc4a14b2016..1838eb95a7d 100644 --- a/Doc/library/asyncio-dev.rst +++ b/Doc/library/asyncio-dev.rst @@ -52,7 +52,7 @@ Cancellation ------------ Cancellation of tasks is not common in classic programming. In asynchronous -programming, not only it is something common, but you have to prepare your +programming, not only is it something common, but you have to prepare your code to handle it. Futures and tasks can be cancelled explicitly with their :meth:`Future.cancel` From webhook-mailer at python.org Thu Aug 3 10:45:18 2017 From: webhook-mailer at python.org (INADA Naoki) Date: Thu, 03 Aug 2017 14:45:18 -0000 Subject: [Python-checkins] bpo-29304: Simplify dict lookup functions (GH-2407) Message-ID: https://github.com/python/cpython/commit/778928b0c7aa438c282727535814d73df850693a commit: 778928b0c7aa438c282727535814d73df850693a branch: master author: INADA Naoki committer: GitHub date: 2017-08-03T23:45:15+09:00 summary: bpo-29304: Simplify dict lookup functions (GH-2407) * remove hashpos parameter from lookdict functions. * remove many duplicated code from lookdict functions. files: M Objects/dict-common.h M Objects/dictobject.c M Objects/odictobject.c diff --git a/Objects/dict-common.h b/Objects/dict-common.h index 62185527347..3e524686b44 100644 --- a/Objects/dict-common.h +++ b/Objects/dict-common.h @@ -12,8 +12,7 @@ typedef struct { * -1 when no entry found, -3 when compare raises error. */ typedef Py_ssize_t (*dict_lookup_func) -(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject **value_addr, - Py_ssize_t *hashpos); + (PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject **value_addr); #define DKIX_EMPTY (-1) #define DKIX_DUMMY (-2) /* Used internally */ diff --git a/Objects/dictobject.c b/Objects/dictobject.c index c44ff47f8b3..e395f4dabb3 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -223,18 +223,14 @@ equally good collision statistics, needed less code & used less memory. /* forward declarations */ static Py_ssize_t lookdict(PyDictObject *mp, PyObject *key, - Py_hash_t hash, PyObject **value_addr, - Py_ssize_t *hashpos); + Py_hash_t hash, PyObject **value_addr); static Py_ssize_t lookdict_unicode(PyDictObject *mp, PyObject *key, - Py_hash_t hash, PyObject **value_addr, - Py_ssize_t *hashpos); + Py_hash_t hash, PyObject **value_addr); static Py_ssize_t lookdict_unicode_nodummy(PyDictObject *mp, PyObject *key, - Py_hash_t hash, PyObject **value_addr, - Py_ssize_t *hashpos); + Py_hash_t hash, PyObject **value_addr); static Py_ssize_t lookdict_split(PyDictObject *mp, PyObject *key, - Py_hash_t hash, PyObject **value_addr, - Py_ssize_t *hashpos); + Py_hash_t hash, PyObject **value_addr); static int dictresize(PyDictObject *mp, Py_ssize_t minused); @@ -672,118 +668,59 @@ never raise an exception; that function can never return DKIX_ERROR when key is string. Otherwise, it falls back to lookdict(). lookdict_unicode_nodummy is further specialized for string keys that cannot be the value. -For both, when the key isn't found a DKIX_EMPTY is returned. hashpos returns -where the key index should be inserted. +For both, when the key isn't found a DKIX_EMPTY is returned. */ static Py_ssize_t _Py_HOT_FUNCTION lookdict(PyDictObject *mp, PyObject *key, - Py_hash_t hash, PyObject **value_addr, Py_ssize_t *hashpos) + Py_hash_t hash, PyObject **value_addr) { - size_t i, mask; - Py_ssize_t ix, freeslot; - int cmp; + size_t i, mask, perturb; PyDictKeysObject *dk; - PyDictKeyEntry *ep0, *ep; - PyObject *startkey; + PyDictKeyEntry *ep0; top: dk = mp->ma_keys; - mask = DK_MASK(dk); ep0 = DK_ENTRIES(dk); + mask = DK_MASK(dk); + perturb = hash; i = (size_t)hash & mask; - ix = dk_get_index(dk, i); - if (ix == DKIX_EMPTY) { - if (hashpos != NULL) - *hashpos = i; - *value_addr = NULL; - return DKIX_EMPTY; - } - if (ix == DKIX_DUMMY) { - freeslot = i; - } - else { - ep = &ep0[ix]; - assert(ep->me_key != NULL); - if (ep->me_key == key) { - *value_addr = ep->me_value; - if (hashpos != NULL) - *hashpos = i; - return ix; - } - if (ep->me_hash == hash) { - startkey = ep->me_key; - Py_INCREF(startkey); - cmp = PyObject_RichCompareBool(startkey, key, Py_EQ); - Py_DECREF(startkey); - if (cmp < 0) { - *value_addr = NULL; - return DKIX_ERROR; - } - if (dk == mp->ma_keys && ep->me_key == startkey) { - if (cmp > 0) { - *value_addr = ep->me_value; - if (hashpos != NULL) - *hashpos = i; - return ix; - } - } - else { - /* The dict was mutated, restart */ - goto top; - } - } - freeslot = -1; - } - - for (size_t perturb = hash;;) { - perturb >>= PERTURB_SHIFT; - i = (i*5 + perturb + 1) & mask; - ix = dk_get_index(dk, i); + for (;;) { + Py_ssize_t ix = dk_get_index(dk, i); if (ix == DKIX_EMPTY) { - if (hashpos != NULL) { - *hashpos = (freeslot == -1) ? (Py_ssize_t)i : freeslot; - } *value_addr = NULL; return ix; } - if (ix == DKIX_DUMMY) { - if (freeslot == -1) - freeslot = i; - continue; - } - ep = &ep0[ix]; - assert(ep->me_key != NULL); - if (ep->me_key == key) { - if (hashpos != NULL) { - *hashpos = i; - } - *value_addr = ep->me_value; - return ix; - } - if (ep->me_hash == hash) { - startkey = ep->me_key; - Py_INCREF(startkey); - cmp = PyObject_RichCompareBool(startkey, key, Py_EQ); - Py_DECREF(startkey); - if (cmp < 0) { - *value_addr = NULL; - return DKIX_ERROR; + if (ix >= 0) { + PyDictKeyEntry *ep = &ep0[ix]; + assert(ep->me_key != NULL); + if (ep->me_key == key) { + *value_addr = ep->me_value; + return ix; } - if (dk == mp->ma_keys && ep->me_key == startkey) { - if (cmp > 0) { - if (hashpos != NULL) { - *hashpos = i; + if (ep->me_hash == hash) { + PyObject *startkey = ep->me_key; + Py_INCREF(startkey); + int cmp = PyObject_RichCompareBool(startkey, key, Py_EQ); + Py_DECREF(startkey); + if (cmp < 0) { + *value_addr = NULL; + return DKIX_ERROR; + } + if (dk == mp->ma_keys && ep->me_key == startkey) { + if (cmp > 0) { + *value_addr = ep->me_value; + return ix; } - *value_addr = ep->me_value; - return ix; } - } - else { - /* The dict was mutated, restart */ - goto top; + else { + /* The dict was mutated, restart */ + goto top; + } } } + perturb >>= PERTURB_SHIFT; + i = (i*5 + perturb + 1) & mask; } assert(0); /* NOT REACHED */ return 0; @@ -792,13 +729,8 @@ lookdict(PyDictObject *mp, PyObject *key, /* Specialized version for string-only keys */ static Py_ssize_t _Py_HOT_FUNCTION lookdict_unicode(PyDictObject *mp, PyObject *key, - Py_hash_t hash, PyObject **value_addr, Py_ssize_t *hashpos) + Py_hash_t hash, PyObject **value_addr) { - size_t i; - size_t mask = DK_MASK(mp->ma_keys); - Py_ssize_t ix, freeslot; - PyDictKeyEntry *ep, *ep0 = DK_ENTRIES(mp->ma_keys); - assert(mp->ma_values == NULL); /* Make sure this function doesn't have to handle non-unicode keys, including subclasses of str; e.g., one reason to subclass @@ -806,59 +738,34 @@ lookdict_unicode(PyDictObject *mp, PyObject *key, that here. */ if (!PyUnicode_CheckExact(key)) { mp->ma_keys->dk_lookup = lookdict; - return lookdict(mp, key, hash, value_addr, hashpos); - } - i = (size_t)hash & mask; - ix = dk_get_index(mp->ma_keys, i); - if (ix == DKIX_EMPTY) { - if (hashpos != NULL) - *hashpos = i; - *value_addr = NULL; - return DKIX_EMPTY; - } - if (ix == DKIX_DUMMY) { - freeslot = i; - } - else { - ep = &ep0[ix]; - assert(ep->me_key != NULL); - if (ep->me_key == key - || (ep->me_hash == hash && unicode_eq(ep->me_key, key))) { - if (hashpos != NULL) - *hashpos = i; - *value_addr = ep->me_value; - return ix; - } - freeslot = -1; + return lookdict(mp, key, hash, value_addr); } - for (size_t perturb = hash;;) { - perturb >>= PERTURB_SHIFT; - i = mask & (i*5 + perturb + 1); - ix = dk_get_index(mp->ma_keys, i); + PyDictKeyEntry *ep0 = DK_ENTRIES(mp->ma_keys); + size_t mask = DK_MASK(mp->ma_keys); + size_t perturb = (size_t)hash; + size_t i = (size_t)hash & mask; + + for (;;) { + Py_ssize_t ix = dk_get_index(mp->ma_keys, i); if (ix == DKIX_EMPTY) { - if (hashpos != NULL) { - *hashpos = (freeslot == -1) ? (Py_ssize_t)i : freeslot; - } *value_addr = NULL; return DKIX_EMPTY; } - if (ix == DKIX_DUMMY) { - if (freeslot == -1) - freeslot = i; - continue; - } - ep = &ep0[ix]; - assert(ep->me_key != NULL); - if (ep->me_key == key - || (ep->me_hash == hash && unicode_eq(ep->me_key, key))) { - *value_addr = ep->me_value; - if (hashpos != NULL) { - *hashpos = i; + if (ix >= 0) { + PyDictKeyEntry *ep = &ep0[ix]; + assert(ep->me_key != NULL); + assert(PyUnicode_CheckExact(ep->me_key)); + if (ep->me_key == key || + (ep->me_hash == hash && unicode_eq(ep->me_key, key))) { + *value_addr = ep->me_value; + return ix; } - return ix; } + perturb >>= PERTURB_SHIFT; + i = mask & (i*5 + perturb + 1); } + assert(0); /* NOT REACHED */ return 0; } @@ -867,14 +774,8 @@ lookdict_unicode(PyDictObject *mp, PyObject *key, * will be present. */ static Py_ssize_t _Py_HOT_FUNCTION lookdict_unicode_nodummy(PyDictObject *mp, PyObject *key, - Py_hash_t hash, PyObject **value_addr, - Py_ssize_t *hashpos) + Py_hash_t hash, PyObject **value_addr) { - size_t i; - size_t mask = DK_MASK(mp->ma_keys); - Py_ssize_t ix; - PyDictKeyEntry *ep, *ep0 = DK_ENTRIES(mp->ma_keys); - assert(mp->ma_values == NULL); /* Make sure this function doesn't have to handle non-unicode keys, including subclasses of str; e.g., one reason to subclass @@ -882,47 +783,31 @@ lookdict_unicode_nodummy(PyDictObject *mp, PyObject *key, that here. */ if (!PyUnicode_CheckExact(key)) { mp->ma_keys->dk_lookup = lookdict; - return lookdict(mp, key, hash, value_addr, hashpos); + return lookdict(mp, key, hash, value_addr); } - i = (size_t)hash & mask; - ix = dk_get_index(mp->ma_keys, i); - assert (ix != DKIX_DUMMY); - if (ix == DKIX_EMPTY) { - if (hashpos != NULL) - *hashpos = i; - *value_addr = NULL; - return DKIX_EMPTY; - } - ep = &ep0[ix]; - assert(ep->me_key != NULL); - assert(PyUnicode_CheckExact(ep->me_key)); - if (ep->me_key == key || - (ep->me_hash == hash && unicode_eq(ep->me_key, key))) { - if (hashpos != NULL) - *hashpos = i; - *value_addr = ep->me_value; - return ix; - } - for (size_t perturb = hash;;) { - perturb >>= PERTURB_SHIFT; - i = mask & (i*5 + perturb + 1); - ix = dk_get_index(mp->ma_keys, i); + + PyDictKeyEntry *ep0 = DK_ENTRIES(mp->ma_keys); + size_t mask = DK_MASK(mp->ma_keys); + size_t perturb = (size_t)hash; + size_t i = (size_t)hash & mask; + + for (;;) { + Py_ssize_t ix = dk_get_index(mp->ma_keys, i); assert (ix != DKIX_DUMMY); if (ix == DKIX_EMPTY) { - if (hashpos != NULL) - *hashpos = i; *value_addr = NULL; return DKIX_EMPTY; } - ep = &ep0[ix]; - assert(ep->me_key != NULL && PyUnicode_CheckExact(ep->me_key)); + PyDictKeyEntry *ep = &ep0[ix]; + assert(ep->me_key != NULL); + assert(PyUnicode_CheckExact(ep->me_key)); if (ep->me_key == key || (ep->me_hash == hash && unicode_eq(ep->me_key, key))) { - if (hashpos != NULL) - *hashpos = i; *value_addr = ep->me_value; return ix; } + perturb >>= PERTURB_SHIFT; + i = mask & (i*5 + perturb + 1); } assert(0); /* NOT REACHED */ return 0; @@ -935,61 +820,40 @@ lookdict_unicode_nodummy(PyDictObject *mp, PyObject *key, */ static Py_ssize_t _Py_HOT_FUNCTION lookdict_split(PyDictObject *mp, PyObject *key, - Py_hash_t hash, PyObject **value_addr, Py_ssize_t *hashpos) + Py_hash_t hash, PyObject **value_addr) { - size_t i; - size_t mask = DK_MASK(mp->ma_keys); - Py_ssize_t ix; - PyDictKeyEntry *ep, *ep0 = DK_ENTRIES(mp->ma_keys); - /* mp must split table */ assert(mp->ma_values != NULL); if (!PyUnicode_CheckExact(key)) { - ix = lookdict(mp, key, hash, value_addr, hashpos); + Py_ssize_t ix = lookdict(mp, key, hash, value_addr); if (ix >= 0) { *value_addr = mp->ma_values[ix]; } return ix; } - i = (size_t)hash & mask; - ix = dk_get_index(mp->ma_keys, i); - if (ix == DKIX_EMPTY) { - if (hashpos != NULL) - *hashpos = i; - *value_addr = NULL; - return DKIX_EMPTY; - } - assert(ix >= 0); - ep = &ep0[ix]; - assert(ep->me_key != NULL && PyUnicode_CheckExact(ep->me_key)); - if (ep->me_key == key || - (ep->me_hash == hash && unicode_eq(ep->me_key, key))) { - if (hashpos != NULL) - *hashpos = i; - *value_addr = mp->ma_values[ix]; - return ix; - } - for (size_t perturb = hash;;) { - perturb >>= PERTURB_SHIFT; - i = mask & (i*5 + perturb + 1); - ix = dk_get_index(mp->ma_keys, i); + PyDictKeyEntry *ep0 = DK_ENTRIES(mp->ma_keys); + size_t mask = DK_MASK(mp->ma_keys); + size_t perturb = (size_t)hash; + size_t i = (size_t)hash & mask; + + for (;;) { + Py_ssize_t ix = dk_get_index(mp->ma_keys, i); + assert (ix != DKIX_DUMMY); if (ix == DKIX_EMPTY) { - if (hashpos != NULL) - *hashpos = i; *value_addr = NULL; return DKIX_EMPTY; } - assert(ix >= 0); - ep = &ep0[ix]; - assert(ep->me_key != NULL && PyUnicode_CheckExact(ep->me_key)); + PyDictKeyEntry *ep = &ep0[ix]; + assert(ep->me_key != NULL); + assert(PyUnicode_CheckExact(ep->me_key)); if (ep->me_key == key || (ep->me_hash == hash && unicode_eq(ep->me_key, key))) { - if (hashpos != NULL) - *hashpos = i; *value_addr = mp->ma_values[ix]; return ix; } + perturb >>= PERTURB_SHIFT; + i = mask & (i*5 + perturb + 1); } assert(0); /* NOT REACHED */ return 0; @@ -1061,23 +925,19 @@ _PyDict_MaybeUntrack(PyObject *op) The dict must be combined. */ static Py_ssize_t -find_empty_slot(PyDictKeysObject *keys, PyObject *key, Py_hash_t hash) +find_empty_slot(PyDictKeysObject *keys, Py_hash_t hash) { - size_t i; - size_t mask = DK_MASK(keys); - Py_ssize_t ix; - - assert(key != NULL); + assert(keys != NULL); - i = hash & mask; - ix = dk_get_index(keys, i); - for (size_t perturb = hash; ix != DKIX_EMPTY;) { + const size_t mask = DK_MASK(keys); + size_t i = hash & mask; + Py_ssize_t ix = dk_get_index(keys, i); + for (size_t perturb = hash; ix >= 0;) { perturb >>= PERTURB_SHIFT; - i = i*5 + perturb + 1; - ix = dk_get_index(keys, i & mask); + i = (i*5 + perturb + 1) & mask; + ix = dk_get_index(keys, i); } - assert(DK_ENTRIES(keys)[keys->dk_nentries].me_value == NULL); - return i & mask; + return i; } static int @@ -1096,7 +956,6 @@ insertdict(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject *value) { PyObject *old_value; PyDictKeyEntry *ep; - Py_ssize_t hashpos, ix; Py_INCREF(key); Py_INCREF(value); @@ -1105,7 +964,7 @@ insertdict(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject *value) goto Fail; } - ix = mp->ma_keys->dk_lookup(mp, key, hash, &old_value, &hashpos); + Py_ssize_t ix = mp->ma_keys->dk_lookup(mp, key, hash, &old_value); if (ix == DKIX_ERROR) goto Fail; @@ -1120,7 +979,6 @@ insertdict(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject *value) (ix == DKIX_EMPTY && mp->ma_used != mp->ma_keys->dk_nentries))) { if (insertion_resize(mp) < 0) goto Fail; - hashpos = find_empty_slot(mp->ma_keys, key, hash); ix = DKIX_EMPTY; } @@ -1131,8 +989,8 @@ insertdict(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject *value) /* Need to resize. */ if (insertion_resize(mp) < 0) goto Fail; - hashpos = find_empty_slot(mp->ma_keys, key, hash); } + Py_ssize_t hashpos = find_empty_slot(mp->ma_keys, hash); ep = &DK_ENTRIES(mp->ma_keys)[mp->ma_keys->dk_nentries]; dk_set_index(mp->ma_keys, hashpos, mp->ma_keys->dk_nentries); ep->me_key = key; @@ -1411,14 +1269,14 @@ PyDict_GetItem(PyObject *op, PyObject *key) /* preserve the existing exception */ PyObject *err_type, *err_value, *err_tb; PyErr_Fetch(&err_type, &err_value, &err_tb); - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value, NULL); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value); /* ignore errors */ PyErr_Restore(err_type, err_value, err_tb); if (ix < 0) return NULL; } else { - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value, NULL); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value); if (ix < 0) { PyErr_Clear(); return NULL; @@ -1443,7 +1301,7 @@ _PyDict_GetItem_KnownHash(PyObject *op, PyObject *key, Py_hash_t hash) return NULL; } - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value, NULL); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value); if (ix < 0) { return NULL; } @@ -1475,7 +1333,7 @@ PyDict_GetItemWithError(PyObject *op, PyObject *key) } } - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value, NULL); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value); if (ix < 0) return NULL; return value; @@ -1514,14 +1372,14 @@ _PyDict_LoadGlobal(PyDictObject *globals, PyDictObject *builtins, PyObject *key) } /* namespace 1: globals */ - ix = globals->ma_keys->dk_lookup(globals, key, hash, &value, NULL); + ix = globals->ma_keys->dk_lookup(globals, key, hash, &value); if (ix == DKIX_ERROR) return NULL; if (ix != DKIX_EMPTY && value != NULL) return value; /* namespace 2: builtins */ - ix = builtins->ma_keys->dk_lookup(builtins, key, hash, &value, NULL); + ix = builtins->ma_keys->dk_lookup(builtins, key, hash, &value); if (ix < 0) return NULL; return value; @@ -1577,12 +1435,15 @@ _PyDict_SetItem_KnownHash(PyObject *op, PyObject *key, PyObject *value, } static int -delitem_common(PyDictObject *mp, Py_ssize_t hashpos, Py_ssize_t ix, +delitem_common(PyDictObject *mp, Py_hash_t hash, Py_ssize_t ix, PyObject *old_value) { PyObject *old_key; PyDictKeyEntry *ep; + Py_ssize_t hashpos = lookdict_index(mp->ma_keys, hash, ix); + assert(hashpos >= 0); + mp->ma_used--; mp->ma_version_tag = DICT_NEXT_VERSION(); ep = &DK_ENTRIES(mp->ma_keys)[ix]; @@ -1616,7 +1477,7 @@ PyDict_DelItem(PyObject *op, PyObject *key) int _PyDict_DelItem_KnownHash(PyObject *op, PyObject *key, Py_hash_t hash) { - Py_ssize_t hashpos, ix; + Py_ssize_t ix; PyDictObject *mp; PyObject *old_value; @@ -1627,25 +1488,24 @@ _PyDict_DelItem_KnownHash(PyObject *op, PyObject *key, Py_hash_t hash) assert(key); assert(hash != -1); mp = (PyDictObject *)op; - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &old_value, &hashpos); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &old_value); if (ix == DKIX_ERROR) return -1; if (ix == DKIX_EMPTY || old_value == NULL) { _PyErr_SetKeyError(key); return -1; } - assert(dk_get_index(mp->ma_keys, hashpos) == ix); // Split table doesn't allow deletion. Combine it. if (_PyDict_HasSplitTable(mp)) { if (dictresize(mp, DK_SIZE(mp->ma_keys))) { return -1; } - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &old_value, &hashpos); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &old_value); assert(ix >= 0); } - return delitem_common(mp, hashpos, ix, old_value); + return delitem_common(mp, hash, ix, old_value); } /* This function promises that the predicate -> deletion sequence is atomic @@ -1671,27 +1531,30 @@ _PyDict_DelItemIf(PyObject *op, PyObject *key, if (hash == -1) return -1; mp = (PyDictObject *)op; - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &old_value, &hashpos); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &old_value); if (ix == DKIX_ERROR) return -1; if (ix == DKIX_EMPTY || old_value == NULL) { _PyErr_SetKeyError(key); return -1; } - assert(dk_get_index(mp->ma_keys, hashpos) == ix); // Split table doesn't allow deletion. Combine it. if (_PyDict_HasSplitTable(mp)) { if (dictresize(mp, DK_SIZE(mp->ma_keys))) { return -1; } - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &old_value, &hashpos); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &old_value); assert(ix >= 0); } res = predicate(old_value); if (res == -1) return -1; + + hashpos = lookdict_index(mp->ma_keys, hash, ix); + assert(hashpos >= 0); + if (res > 0) return delitem_common(mp, hashpos, ix, old_value); else @@ -1828,7 +1691,7 @@ _PyDict_Pop_KnownHash(PyObject *dict, PyObject *key, Py_hash_t hash, PyObject *d _PyErr_SetKeyError(key); return NULL; } - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &old_value, &hashpos); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &old_value); if (ix == DKIX_ERROR) return NULL; if (ix == DKIX_EMPTY || old_value == NULL) { @@ -1845,10 +1708,12 @@ _PyDict_Pop_KnownHash(PyObject *dict, PyObject *key, Py_hash_t hash, PyObject *d if (dictresize(mp, DK_SIZE(mp->ma_keys))) { return NULL; } - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &old_value, &hashpos); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &old_value); assert(ix >= 0); } + hashpos = lookdict_index(mp->ma_keys, hash, ix); + assert(hashpos >= 0); assert(old_value != NULL); mp->ma_used--; mp->ma_version_tag = DICT_NEXT_VERSION(); @@ -2107,7 +1972,7 @@ dict_subscript(PyDictObject *mp, PyObject *key) if (hash == -1) return NULL; } - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value, NULL); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value); if (ix == DKIX_ERROR) return NULL; if (ix == DKIX_EMPTY || value == NULL) { @@ -2718,7 +2583,7 @@ dict_equal(PyDictObject *a, PyDictObject *b) /* ditto for key */ Py_INCREF(key); /* reuse the known hash value */ - b->ma_keys->dk_lookup(b, key, ep->me_hash, &bval, NULL); + b->ma_keys->dk_lookup(b, key, ep->me_hash, &bval); if (bval == NULL) { Py_DECREF(key); Py_DECREF(aval); @@ -2783,7 +2648,7 @@ dict___contains__(PyDictObject *self, PyObject *key) if (hash == -1) return NULL; } - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value, NULL); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value); if (ix == DKIX_ERROR) return NULL; if (ix == DKIX_EMPTY || value == NULL) @@ -2815,7 +2680,7 @@ dict_get_impl(PyDictObject *self, PyObject *key, PyObject *default_value) if (hash == -1) return NULL; } - ix = (self->ma_keys->dk_lookup) (self, key, hash, &val, NULL); + ix = (self->ma_keys->dk_lookup) (self, key, hash, &val); if (ix == DKIX_ERROR) return NULL; if (ix == DKIX_EMPTY || val == NULL) { @@ -2831,7 +2696,6 @@ PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *defaultobj) PyDictObject *mp = (PyDictObject *)d; PyObject *value; Py_hash_t hash; - Py_ssize_t hashpos, ix; if (!PyDict_Check(d)) { PyErr_BadInternalCall(); @@ -2850,7 +2714,7 @@ PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *defaultobj) return NULL; } - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value, &hashpos); + Py_ssize_t ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value); if (ix == DKIX_ERROR) return NULL; @@ -2860,7 +2724,6 @@ PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *defaultobj) if (insertion_resize(mp) < 0) { return NULL; } - hashpos = find_empty_slot(mp->ma_keys, key, hash); ix = DKIX_EMPTY; } @@ -2871,8 +2734,8 @@ PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *defaultobj) if (insertion_resize(mp) < 0) { return NULL; } - hashpos = find_empty_slot(mp->ma_keys, key, hash); } + Py_ssize_t hashpos = find_empty_slot(mp->ma_keys, hash); ep0 = DK_ENTRIES(mp->ma_keys); ep = &ep0[mp->ma_keys->dk_nentries]; dk_set_index(mp->ma_keys, hashpos, mp->ma_keys->dk_nentries); @@ -3167,7 +3030,7 @@ PyDict_Contains(PyObject *op, PyObject *key) if (hash == -1) return -1; } - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value, NULL); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value); if (ix == DKIX_ERROR) return -1; return (ix != DKIX_EMPTY && value != NULL); @@ -3181,7 +3044,7 @@ _PyDict_Contains(PyObject *op, PyObject *key, Py_hash_t hash) PyObject *value; Py_ssize_t ix; - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value, NULL); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value); if (ix == DKIX_ERROR) return -1; return (ix != DKIX_EMPTY && value != NULL); diff --git a/Objects/odictobject.c b/Objects/odictobject.c index 771dcc308c5..c3d1a09584e 100644 --- a/Objects/odictobject.c +++ b/Objects/odictobject.c @@ -546,7 +546,7 @@ _odict_get_index_raw(PyODictObject *od, PyObject *key, Py_hash_t hash) PyDictKeysObject *keys = ((PyDictObject *)od)->ma_keys; Py_ssize_t ix; - ix = (keys->dk_lookup)((PyDictObject *)od, key, hash, &value, NULL); + ix = (keys->dk_lookup)((PyDictObject *)od, key, hash, &value); if (ix == DKIX_EMPTY) { return keys->dk_nentries; /* index of new entry */ } From lp_benchmark_robot at intel.com Thu Aug 3 21:08:27 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 3 Aug 2017 18:08:27 -0700 Subject: [Python-checkins] [1 up, 64 flat] Results for Python (master branch) 2017-08-03 Message-ID: <8c402fe2-c817-40b2-95a7-0f459d7a728f@orsmsx110.amr.corp.intel.com> Results for project python/master, build date: 2017-08-03 03:03:29-07:00. - commit: 5075416 - previous commit: de34cbe - revision date: 2017-08-03 11:45:23+03:00 - environment: Broadwell-EP - cpu: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz 2x22 cores, stepping 1, LLC 55 MB - mem: 128 GB - os: Ubuntu 16.04.2 LTS - kernel: 4.4.0-62-generic x86_64 GNU/Linux Baseline results were generated using release v3.6.0, with hash 5c4568a from 2016-12-22 23:38:47+00:00. +-----+------------------------+--------+------------+------------+------------+ | | |relative|change since|change since|current rev | | | benchmark|std_dev*| last run | baseline |run with PGO| +-----+------------------------+--------+------------+------------+------------+ | :-| | 2to3| 1.254% | -0.435% | +4.240% | +7.513% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method| 1.815% | -0.104% | +22.253% | +10.079% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_slots| 1.354% | +1.000% | +23.774% | +9.112% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_unknown| 1.234% | +0.076% | +21.601% | +6.895% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_simple| 3.441% | -1.697% | +5.679% | +11.707% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chameleon| 1.363% | -0.031% | +11.630% | +10.952% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chaos| 1.003% | +0.059% | +7.651% | +9.770% | +-----+------------------------+--------+------------+------------+------------+ | :-| | crypto_pyaes| 0.575% | +0.052% | +4.436% | +4.693% | +-----+------------------------+--------+------------+------------+------------+ | :-| | deltablue| 3.587% | +1.828% | +9.919% | +14.700% | +-----+------------------------+--------+------------+------------+------------+ | :-| | django_template| 4.250% | +0.013% | +9.875% | +11.825% | +-----+------------------------+--------+------------+------------+------------+ | :-| | dulwich_log| 0.658% | -0.327% | +3.177% | +6.690% | +-----+------------------------+--------+------------+------------+------------+ | :-| | fannkuch| 0.641% | +2.095% | +6.574% | +3.484% | +-----+------------------------+--------+------------+------------+------------+ | :-| | float| 0.858% | +0.009% | +4.433% | +5.165% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_text| 1.358% | -0.407% | +9.306% | +10.584% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_xml| 2.256% | +1.114% | +8.451% | +7.910% | +-----+------------------------+--------+------------+------------+------------+ | :-| | go| 0.956% | +1.064% | +7.099% | +10.664% | +-----+------------------------+--------+------------+------------+------------+ | :-| | hexiom| 1.552% | -1.209% | +9.277% | +11.600% | +-----+------------------------+--------+------------+------------+------------+ | :-| | html5lib| 3.374% | +0.516% | +8.917% | +8.640% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_dumps| 1.748% | +0.288% | +4.594% | +8.189% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_loads| 1.360% | +0.852% | +4.635% | +9.801% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_format| 1.618% | -0.534% | +8.476% | +12.003% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_silent| 2.300% | +0.173% | +47.501% | +11.380% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_simple| 1.562% | -0.814% | +9.615% | +13.141% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mako| 0.505% | +0.907% | +19.556% | +10.697% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mdp| 7.944% | -3.376% | +0.805% | +17.800% | +-----+------------------------+--------+------------+------------+------------+ | :-| | meteor_contest| 2.286% | +0.464% | +4.143% | +5.778% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nbody| 1.191% | +1.840% | -2.294% | +3.265% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nqueens| 0.774% | +1.818% | +3.872% | +5.359% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pathlib| 1.498% | -0.914% | -0.876% | +14.612% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle| 4.300% | -0.864% | +1.734% | +21.366% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_dict| 0.252% | +0.899% | +4.683% | +13.517% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_list| 0.778% | +1.300% | +5.177% | +15.369% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_pure_python| 4.097% | -0.078% | +12.788% | +9.178% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pidigits| 0.198% | +0.180% | +0.374% | +9.357% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup| 0.118% | +0.109% | +9.713% | +4.425% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup_no_site| 0.095% | +0.102% | +1.487% | +4.361% | +-----+------------------------+--------+------------+------------+------------+ | :-| | raytrace| 1.288% | -0.866% | +10.494% | +11.975% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_compile| 4.982% | -3.208% | -8.884% | +10.529% | +-----+------------------------+--------+------------+------------+------------+ | :-) | regex_dna| 0.668% | +3.659% | +2.035% | +9.468% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_effbot| 2.445% | +0.437% | +0.314% | +3.707% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_v8| 1.038% | +0.653% | +11.388% | +4.241% | +-----+------------------------+--------+------------+------------+------------+ | :-| | richards| 1.405% | -1.436% | +7.412% | +13.361% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_fft| 1.292% | -1.576% | -0.142% | +2.089% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_lu| 2.056% | +1.524% | +27.816% | +7.825% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_monte_carlo| 1.404% | -0.408% | +5.794% | +5.297% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sor| 1.184% | -0.376% | +15.567% | +8.247% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sparse_mat_mult| 2.049% | -2.496% | +0.743% | -1.885% | +-----+------------------------+--------+------------+------------+------------+ | :-| | spectral_norm| 0.742% | -1.329% | +5.168% | +2.053% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_declarative| 1.051% | -0.159% | +5.308% | +7.267% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_imperative| 3.099% | -0.256% | +5.256% | +3.565% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlite_synth| 2.820% | +0.731% | +2.629% | +8.977% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_expand| 2.034% | -0.517% | +12.667% | +7.224% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_integrate| 1.648% | -0.457% | +10.631% | +6.118% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_str| 2.977% | -0.264% | +12.225% | +8.921% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_sum| 4.274% | +0.019% | +13.952% | +8.216% | +-----+------------------------+--------+------------+------------+------------+ | :-| | telco| 3.361% | +2.985% | +24.038% | +7.573% | +-----+------------------------+--------+------------+------------+------------+ | :-| | tornado_http| 1.156% | -0.481% | +5.746% | +5.292% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpack_sequence| 1.320% | -0.234% | -0.158% | -0.143% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle| 6.185% | +2.077% | +10.972% | +19.005% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_list| 1.313% | +1.210% | -2.649% | +19.221% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_pure_python| 2.791% | +0.729% | +7.437% | +6.074% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_generate| 0.890% | +0.731% | +5.716% | +8.542% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_iterparse| 2.839% | -0.634% | +1.821% | +6.250% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_parse| 2.236% | -0.396% | -5.799% | +10.555% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_process| 1.380% | +0.658% | +6.416% | +8.303% | +-----+------------------------+--------+------------+------------+------------+ * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/1-up-64-flat-results-for-python-master-branch-2017-08-03 Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From webhook-mailer at python.org Thu Aug 3 22:00:15 2017 From: webhook-mailer at python.org (Mariatta) Date: Fri, 04 Aug 2017 02:00:15 -0000 Subject: [Python-checkins] bpo-27470: Improve doc for commandline -3 option Message-ID: https://github.com/python/cpython/commit/dd6e4aa113c6db4fcf9d252b5063ab217e8330a2 commit: dd6e4aa113c6db4fcf9d252b5063ab217e8330a2 branch: 2.7 author: Subhendu Ghosh committer: Mariatta date: 2017-08-04T12:00:10+10:00 summary: bpo-27470: Improve doc for commandline -3 option Mention that it warns about features that are significantly changed in Python 3 and can?t be detected using static code analysis. Link to Porting Python 2 Code to Python 3 doc files: M Doc/using/cmdline.rst diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst index b567818858f..f00f7f6026a 100644 --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -417,10 +417,12 @@ Miscellaneous options Warn about Python 3.x possible incompatibilities by emitting a :exc:`DeprecationWarning` for features that are removed or significantly - changed in Python 3. + changed in Python 3 and can't be detected using static code analysis. .. versionadded:: 2.6 + See :doc:`/howto/pyporting` for more details. + Options you shouldn't use ~~~~~~~~~~~~~~~~~~~~~~~~~ From webhook-mailer at python.org Fri Aug 4 04:45:06 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Fri, 04 Aug 2017 08:45:06 -0000 Subject: [Python-checkins] bpo-31107: Fix copyreg mangled slot names calculation. (#2989) Message-ID: https://github.com/python/cpython/commit/c4c9866064f03646c686d7e08b00aeb203c35c19 commit: c4c9866064f03646c686d7e08b00aeb203c35c19 branch: master author: Shane Harvey committer: Serhiy Storchaka date: 2017-08-04T11:45:00+03:00 summary: bpo-31107: Fix copyreg mangled slot names calculation. (#2989) files: A Misc/NEWS.d/next/Library/2017-08-02-12-48-15.bpo-31107.1t2hn5.rst M Lib/copyreg.py M Lib/test/test_copyreg.py M Misc/ACKS diff --git a/Lib/copyreg.py b/Lib/copyreg.py index ed29d719def..bbe1af4e2e7 100644 --- a/Lib/copyreg.py +++ b/Lib/copyreg.py @@ -128,7 +128,11 @@ class found there. (This assumes classes don't modify their continue # mangled names elif name.startswith('__') and not name.endswith('__'): - names.append('_%s%s' % (c.__name__, name)) + stripped = c.__name__.lstrip('_') + if stripped: + names.append('_%s%s' % (stripped, name)) + else: + names.append(name) else: names.append(name) diff --git a/Lib/test/test_copyreg.py b/Lib/test/test_copyreg.py index 52e887cb36c..e3f1cd81aab 100644 --- a/Lib/test/test_copyreg.py +++ b/Lib/test/test_copyreg.py @@ -16,6 +16,12 @@ class WithWeakref(object): class WithPrivate(object): __slots__ = ('__spam',) +class _WithLeadingUnderscoreAndPrivate(object): + __slots__ = ('__spam',) + +class ___(object): + __slots__ = ('__spam',) + class WithSingleString(object): __slots__ = 'spam' @@ -104,6 +110,10 @@ def test_slotnames(self): self.assertEqual(copyreg._slotnames(WithWeakref), []) expected = ['_WithPrivate__spam'] self.assertEqual(copyreg._slotnames(WithPrivate), expected) + expected = ['_WithLeadingUnderscoreAndPrivate__spam'] + self.assertEqual(copyreg._slotnames(_WithLeadingUnderscoreAndPrivate), + expected) + self.assertEqual(copyreg._slotnames(___), ['__spam']) self.assertEqual(copyreg._slotnames(WithSingleString), ['spam']) expected = ['eggs', 'spam'] expected.sort() diff --git a/Misc/ACKS b/Misc/ACKS index f1f6c147f49..ec7d481a587 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -598,6 +598,7 @@ David Harrigan Brian Harring Jonathan Hartley Travis B. Hartwell +Shane Harvey Larry Hastings Tim Hatch Shane Hathaway diff --git a/Misc/NEWS.d/next/Library/2017-08-02-12-48-15.bpo-31107.1t2hn5.rst b/Misc/NEWS.d/next/Library/2017-08-02-12-48-15.bpo-31107.1t2hn5.rst new file mode 100644 index 00000000000..3c2a15528d8 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-08-02-12-48-15.bpo-31107.1t2hn5.rst @@ -0,0 +1,2 @@ +Fix `copyreg._slotnames()` mangled attribute calculation for classes whose +name begins with an underscore. Patch by Shane Harvey. From solipsis at pitrou.net Fri Aug 4 05:07:51 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 04 Aug 2017 09:07:51 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=-2 Message-ID: <20170804090750.67315.69B924EDCF3B0AD8@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [0, -7, 1] memory blocks, sum=-6 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [-2, 1, 1] memory blocks, sum=0 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogmX2oin', '--timeout', '7200'] From webhook-mailer at python.org Fri Aug 4 13:53:18 2017 From: webhook-mailer at python.org (=?utf-8?q?=C5=81ukasz?= Langa) Date: Fri, 04 Aug 2017 17:53:18 -0000 Subject: [Python-checkins] Fix a shadow-compatible-local warning (#2180) Message-ID: https://github.com/python/cpython/commit/2af565baf498f389105ff71e4ae054c66fe5d55f commit: 2af565baf498f389105ff71e4ae054c66fe5d55f branch: master author: Yuan Chao Chou committer: ?ukasz Langa date: 2017-08-04T10:53:12-07:00 summary: Fix a shadow-compatible-local warning (#2180) Change the shadowing naming, 'value' (Python-ast.c:4652), to 'val' to prevent the variables from being misused. files: M Parser/asdl_c.py M Python/Python-ast.c diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py index 096f5f8c749..b367e10231c 100644 --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -522,8 +522,8 @@ def visitField(self, field, name, sum=None, prod=None, depth=0): self.emit("%s = _Py_asdl_seq_new(len, arena);" % field.name, depth+1) self.emit("if (%s == NULL) goto failed;" % field.name, depth+1) self.emit("for (i = 0; i < len; i++) {", depth+1) - self.emit("%s value;" % ctype, depth+2) - self.emit("res = obj2ast_%s(PyList_GET_ITEM(tmp, i), &value, arena);" % + self.emit("%s val;" % ctype, depth+2) + self.emit("res = obj2ast_%s(PyList_GET_ITEM(tmp, i), &val, arena);" % field.type, depth+2, reflow=False) self.emit("if (res != 0) goto failed;", depth+2) self.emit("if (len != PyList_GET_SIZE(tmp)) {", depth+2) @@ -533,7 +533,7 @@ def visitField(self, field, name, sum=None, prod=None, depth=0): depth+3, reflow=False) self.emit("goto failed;", depth+3) self.emit("}", depth+2) - self.emit("asdl_seq_SET(%s, i, value);" % field.name, depth+2) + self.emit("asdl_seq_SET(%s, i, val);" % field.name, depth+2) self.emit("}", depth+1) else: self.emit("res = obj2ast_%s(tmp, &%s, arena);" % diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 2759b2fe9c4..77852f923f4 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -4017,14 +4017,14 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Module field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -4066,14 +4066,14 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Interactive field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -4127,14 +4127,14 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Suite field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -4235,14 +4235,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "FunctionDef field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -4263,14 +4263,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) decorator_list = _Py_asdl_seq_new(len, arena); if (decorator_list == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "FunctionDef field \"decorator_list\" changed size during iteration"); goto failed; } - asdl_seq_SET(decorator_list, i, value); + asdl_seq_SET(decorator_list, i, val); } Py_CLEAR(tmp); } else { @@ -4350,14 +4350,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "AsyncFunctionDef field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -4378,14 +4378,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) decorator_list = _Py_asdl_seq_new(len, arena); if (decorator_list == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "AsyncFunctionDef field \"decorator_list\" changed size during iteration"); goto failed; } - asdl_seq_SET(decorator_list, i, value); + asdl_seq_SET(decorator_list, i, val); } Py_CLEAR(tmp); } else { @@ -4454,14 +4454,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) bases = _Py_asdl_seq_new(len, arena); if (bases == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"bases\" changed size during iteration"); goto failed; } - asdl_seq_SET(bases, i, value); + asdl_seq_SET(bases, i, val); } Py_CLEAR(tmp); } else { @@ -4482,14 +4482,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) keywords = _Py_asdl_seq_new(len, arena); if (keywords == NULL) goto failed; for (i = 0; i < len; i++) { - keyword_ty value; - res = obj2ast_keyword(PyList_GET_ITEM(tmp, i), &value, arena); + keyword_ty val; + res = obj2ast_keyword(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"keywords\" changed size during iteration"); goto failed; } - asdl_seq_SET(keywords, i, value); + asdl_seq_SET(keywords, i, val); } Py_CLEAR(tmp); } else { @@ -4510,14 +4510,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -4538,14 +4538,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) decorator_list = _Py_asdl_seq_new(len, arena); if (decorator_list == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"decorator_list\" changed size during iteration"); goto failed; } - asdl_seq_SET(decorator_list, i, value); + asdl_seq_SET(decorator_list, i, val); } Py_CLEAR(tmp); } else { @@ -4609,14 +4609,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) targets = _Py_asdl_seq_new(len, arena); if (targets == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Delete field \"targets\" changed size during iteration"); goto failed; } - asdl_seq_SET(targets, i, value); + asdl_seq_SET(targets, i, val); } Py_CLEAR(tmp); } else { @@ -4649,14 +4649,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) targets = _Py_asdl_seq_new(len, arena); if (targets == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Assign field \"targets\" changed size during iteration"); goto failed; } - asdl_seq_SET(targets, i, value); + asdl_seq_SET(targets, i, val); } Py_CLEAR(tmp); } else { @@ -4828,14 +4828,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "For field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -4856,14 +4856,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) orelse = _Py_asdl_seq_new(len, arena); if (orelse == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "For field \"orelse\" changed size during iteration"); goto failed; } - asdl_seq_SET(orelse, i, value); + asdl_seq_SET(orelse, i, val); } Py_CLEAR(tmp); } else { @@ -4920,14 +4920,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "AsyncFor field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -4948,14 +4948,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) orelse = _Py_asdl_seq_new(len, arena); if (orelse == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "AsyncFor field \"orelse\" changed size during iteration"); goto failed; } - asdl_seq_SET(orelse, i, value); + asdl_seq_SET(orelse, i, val); } Py_CLEAR(tmp); } else { @@ -5000,14 +5000,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "While field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -5028,14 +5028,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) orelse = _Py_asdl_seq_new(len, arena); if (orelse == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "While field \"orelse\" changed size during iteration"); goto failed; } - asdl_seq_SET(orelse, i, value); + asdl_seq_SET(orelse, i, val); } Py_CLEAR(tmp); } else { @@ -5080,14 +5080,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "If field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -5108,14 +5108,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) orelse = _Py_asdl_seq_new(len, arena); if (orelse == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "If field \"orelse\" changed size during iteration"); goto failed; } - asdl_seq_SET(orelse, i, value); + asdl_seq_SET(orelse, i, val); } Py_CLEAR(tmp); } else { @@ -5148,14 +5148,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) items = _Py_asdl_seq_new(len, arena); if (items == NULL) goto failed; for (i = 0; i < len; i++) { - withitem_ty value; - res = obj2ast_withitem(PyList_GET_ITEM(tmp, i), &value, arena); + withitem_ty val; + res = obj2ast_withitem(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "With field \"items\" changed size during iteration"); goto failed; } - asdl_seq_SET(items, i, value); + asdl_seq_SET(items, i, val); } Py_CLEAR(tmp); } else { @@ -5176,14 +5176,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "With field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -5216,14 +5216,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) items = _Py_asdl_seq_new(len, arena); if (items == NULL) goto failed; for (i = 0; i < len; i++) { - withitem_ty value; - res = obj2ast_withitem(PyList_GET_ITEM(tmp, i), &value, arena); + withitem_ty val; + res = obj2ast_withitem(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "AsyncWith field \"items\" changed size during iteration"); goto failed; } - asdl_seq_SET(items, i, value); + asdl_seq_SET(items, i, val); } Py_CLEAR(tmp); } else { @@ -5244,14 +5244,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "AsyncWith field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -5318,14 +5318,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Try field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -5346,14 +5346,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) handlers = _Py_asdl_seq_new(len, arena); if (handlers == NULL) goto failed; for (i = 0; i < len; i++) { - excepthandler_ty value; - res = obj2ast_excepthandler(PyList_GET_ITEM(tmp, i), &value, arena); + excepthandler_ty val; + res = obj2ast_excepthandler(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Try field \"handlers\" changed size during iteration"); goto failed; } - asdl_seq_SET(handlers, i, value); + asdl_seq_SET(handlers, i, val); } Py_CLEAR(tmp); } else { @@ -5374,14 +5374,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) orelse = _Py_asdl_seq_new(len, arena); if (orelse == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Try field \"orelse\" changed size during iteration"); goto failed; } - asdl_seq_SET(orelse, i, value); + asdl_seq_SET(orelse, i, val); } Py_CLEAR(tmp); } else { @@ -5402,14 +5402,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) finalbody = _Py_asdl_seq_new(len, arena); if (finalbody == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Try field \"finalbody\" changed size during iteration"); goto failed; } - asdl_seq_SET(finalbody, i, value); + asdl_seq_SET(finalbody, i, val); } Py_CLEAR(tmp); } else { @@ -5475,14 +5475,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) names = _Py_asdl_seq_new(len, arena); if (names == NULL) goto failed; for (i = 0; i < len; i++) { - alias_ty value; - res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &value, arena); + alias_ty val; + res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Import field \"names\" changed size during iteration"); goto failed; } - asdl_seq_SET(names, i, value); + asdl_seq_SET(names, i, val); } Py_CLEAR(tmp); } else { @@ -5526,14 +5526,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) names = _Py_asdl_seq_new(len, arena); if (names == NULL) goto failed; for (i = 0; i < len; i++) { - alias_ty value; - res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &value, arena); + alias_ty val; + res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ImportFrom field \"names\" changed size during iteration"); goto failed; } - asdl_seq_SET(names, i, value); + asdl_seq_SET(names, i, val); } Py_CLEAR(tmp); } else { @@ -5575,14 +5575,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) names = _Py_asdl_seq_new(len, arena); if (names == NULL) goto failed; for (i = 0; i < len; i++) { - identifier value; - res = obj2ast_identifier(PyList_GET_ITEM(tmp, i), &value, arena); + identifier val; + res = obj2ast_identifier(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Global field \"names\" changed size during iteration"); goto failed; } - asdl_seq_SET(names, i, value); + asdl_seq_SET(names, i, val); } Py_CLEAR(tmp); } else { @@ -5614,14 +5614,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) names = _Py_asdl_seq_new(len, arena); if (names == NULL) goto failed; for (i = 0; i < len; i++) { - identifier value; - res = obj2ast_identifier(PyList_GET_ITEM(tmp, i), &value, arena); + identifier val; + res = obj2ast_identifier(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Nonlocal field \"names\" changed size during iteration"); goto failed; } - asdl_seq_SET(names, i, value); + asdl_seq_SET(names, i, val); } Py_CLEAR(tmp); } else { @@ -5759,14 +5759,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) values = _Py_asdl_seq_new(len, arena); if (values == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "BoolOp field \"values\" changed size during iteration"); goto failed; } - asdl_seq_SET(values, i, value); + asdl_seq_SET(values, i, val); } Py_CLEAR(tmp); } else { @@ -5959,14 +5959,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) keys = _Py_asdl_seq_new(len, arena); if (keys == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Dict field \"keys\" changed size during iteration"); goto failed; } - asdl_seq_SET(keys, i, value); + asdl_seq_SET(keys, i, val); } Py_CLEAR(tmp); } else { @@ -5987,14 +5987,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) values = _Py_asdl_seq_new(len, arena); if (values == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Dict field \"values\" changed size during iteration"); goto failed; } - asdl_seq_SET(values, i, value); + asdl_seq_SET(values, i, val); } Py_CLEAR(tmp); } else { @@ -6026,14 +6026,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) elts = _Py_asdl_seq_new(len, arena); if (elts == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Set field \"elts\" changed size during iteration"); goto failed; } - asdl_seq_SET(elts, i, value); + asdl_seq_SET(elts, i, val); } Py_CLEAR(tmp); } else { @@ -6077,14 +6077,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) generators = _Py_asdl_seq_new(len, arena); if (generators == NULL) goto failed; for (i = 0; i < len; i++) { - comprehension_ty value; - res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena); + comprehension_ty val; + res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ListComp field \"generators\" changed size during iteration"); goto failed; } - asdl_seq_SET(generators, i, value); + asdl_seq_SET(generators, i, val); } Py_CLEAR(tmp); } else { @@ -6128,14 +6128,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) generators = _Py_asdl_seq_new(len, arena); if (generators == NULL) goto failed; for (i = 0; i < len; i++) { - comprehension_ty value; - res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena); + comprehension_ty val; + res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "SetComp field \"generators\" changed size during iteration"); goto failed; } - asdl_seq_SET(generators, i, value); + asdl_seq_SET(generators, i, val); } Py_CLEAR(tmp); } else { @@ -6191,14 +6191,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) generators = _Py_asdl_seq_new(len, arena); if (generators == NULL) goto failed; for (i = 0; i < len; i++) { - comprehension_ty value; - res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena); + comprehension_ty val; + res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "DictComp field \"generators\" changed size during iteration"); goto failed; } - asdl_seq_SET(generators, i, value); + asdl_seq_SET(generators, i, val); } Py_CLEAR(tmp); } else { @@ -6242,14 +6242,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) generators = _Py_asdl_seq_new(len, arena); if (generators == NULL) goto failed; for (i = 0; i < len; i++) { - comprehension_ty value; - res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena); + comprehension_ty val; + res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "GeneratorExp field \"generators\" changed size during iteration"); goto failed; } - asdl_seq_SET(generators, i, value); + asdl_seq_SET(generators, i, val); } Py_CLEAR(tmp); } else { @@ -6359,14 +6359,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) ops = _Py_asdl_int_seq_new(len, arena); if (ops == NULL) goto failed; for (i = 0; i < len; i++) { - cmpop_ty value; - res = obj2ast_cmpop(PyList_GET_ITEM(tmp, i), &value, arena); + cmpop_ty val; + res = obj2ast_cmpop(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Compare field \"ops\" changed size during iteration"); goto failed; } - asdl_seq_SET(ops, i, value); + asdl_seq_SET(ops, i, val); } Py_CLEAR(tmp); } else { @@ -6387,14 +6387,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) comparators = _Py_asdl_seq_new(len, arena); if (comparators == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Compare field \"comparators\" changed size during iteration"); goto failed; } - asdl_seq_SET(comparators, i, value); + asdl_seq_SET(comparators, i, val); } Py_CLEAR(tmp); } else { @@ -6439,14 +6439,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) args = _Py_asdl_seq_new(len, arena); if (args == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Call field \"args\" changed size during iteration"); goto failed; } - asdl_seq_SET(args, i, value); + asdl_seq_SET(args, i, val); } Py_CLEAR(tmp); } else { @@ -6467,14 +6467,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) keywords = _Py_asdl_seq_new(len, arena); if (keywords == NULL) goto failed; for (i = 0; i < len; i++) { - keyword_ty value; - res = obj2ast_keyword(PyList_GET_ITEM(tmp, i), &value, arena); + keyword_ty val; + res = obj2ast_keyword(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Call field \"keywords\" changed size during iteration"); goto failed; } - asdl_seq_SET(keywords, i, value); + asdl_seq_SET(keywords, i, val); } Py_CLEAR(tmp); } else { @@ -6595,14 +6595,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) values = _Py_asdl_seq_new(len, arena); if (values == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "JoinedStr field \"values\" changed size during iteration"); goto failed; } - asdl_seq_SET(values, i, value); + asdl_seq_SET(values, i, val); } Py_CLEAR(tmp); } else { @@ -6871,14 +6871,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) elts = _Py_asdl_seq_new(len, arena); if (elts == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "List field \"elts\" changed size during iteration"); goto failed; } - asdl_seq_SET(elts, i, value); + asdl_seq_SET(elts, i, val); } Py_CLEAR(tmp); } else { @@ -6922,14 +6922,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) elts = _Py_asdl_seq_new(len, arena); if (elts == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Tuple field \"elts\" changed size during iteration"); goto failed; } - asdl_seq_SET(elts, i, value); + asdl_seq_SET(elts, i, val); } Py_CLEAR(tmp); } else { @@ -7091,14 +7091,14 @@ obj2ast_slice(PyObject* obj, slice_ty* out, PyArena* arena) dims = _Py_asdl_seq_new(len, arena); if (dims == NULL) goto failed; for (i = 0; i < len; i++) { - slice_ty value; - res = obj2ast_slice(PyList_GET_ITEM(tmp, i), &value, arena); + slice_ty val; + res = obj2ast_slice(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ExtSlice field \"dims\" changed size during iteration"); goto failed; } - asdl_seq_SET(dims, i, value); + asdl_seq_SET(dims, i, val); } Py_CLEAR(tmp); } else { @@ -7455,14 +7455,14 @@ obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena* arena) ifs = _Py_asdl_seq_new(len, arena); if (ifs == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "comprehension field \"ifs\" changed size during iteration"); goto failed; } - asdl_seq_SET(ifs, i, value); + asdl_seq_SET(ifs, i, val); } Py_CLEAR(tmp); } else { @@ -7565,14 +7565,14 @@ obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ExceptHandler field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -7615,14 +7615,14 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena) args = _Py_asdl_seq_new(len, arena); if (args == NULL) goto failed; for (i = 0; i < len; i++) { - arg_ty value; - res = obj2ast_arg(PyList_GET_ITEM(tmp, i), &value, arena); + arg_ty val; + res = obj2ast_arg(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "arguments field \"args\" changed size during iteration"); goto failed; } - asdl_seq_SET(args, i, value); + asdl_seq_SET(args, i, val); } Py_CLEAR(tmp); } else { @@ -7653,14 +7653,14 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena) kwonlyargs = _Py_asdl_seq_new(len, arena); if (kwonlyargs == NULL) goto failed; for (i = 0; i < len; i++) { - arg_ty value; - res = obj2ast_arg(PyList_GET_ITEM(tmp, i), &value, arena); + arg_ty val; + res = obj2ast_arg(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "arguments field \"kwonlyargs\" changed size during iteration"); goto failed; } - asdl_seq_SET(kwonlyargs, i, value); + asdl_seq_SET(kwonlyargs, i, val); } Py_CLEAR(tmp); } else { @@ -7681,14 +7681,14 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena) kw_defaults = _Py_asdl_seq_new(len, arena); if (kw_defaults == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "arguments field \"kw_defaults\" changed size during iteration"); goto failed; } - asdl_seq_SET(kw_defaults, i, value); + asdl_seq_SET(kw_defaults, i, val); } Py_CLEAR(tmp); } else { @@ -7719,14 +7719,14 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena) defaults = _Py_asdl_seq_new(len, arena); if (defaults == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "arguments field \"defaults\" changed size during iteration"); goto failed; } - asdl_seq_SET(defaults, i, value); + asdl_seq_SET(defaults, i, val); } Py_CLEAR(tmp); } else { From webhook-mailer at python.org Fri Aug 4 13:53:45 2017 From: webhook-mailer at python.org (=?utf-8?q?=C5=81ukasz?= Langa) Date: Fri, 04 Aug 2017 17:53:45 -0000 Subject: [Python-checkins] Fix a shadow-compatible-local warning (#2181) Message-ID: https://github.com/python/cpython/commit/a0cb7db8e4b928b4c06da4bde8695555276958f0 commit: a0cb7db8e4b928b4c06da4bde8695555276958f0 branch: 3.6 author: Yuan Chao Chou committer: ?ukasz Langa date: 2017-08-04T10:53:42-07:00 summary: Fix a shadow-compatible-local warning (#2181) Change the shadowing naming, 'value' (Python-ast.c:4686), to 'val' to prevent the variables from being misused. files: M Parser/asdl_c.py M Python/Python-ast.c diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py index 725d73bad47..13124bbd3ad 100644 --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -522,8 +522,8 @@ def visitField(self, field, name, sum=None, prod=None, depth=0): self.emit("%s = _Py_asdl_seq_new(len, arena);" % field.name, depth+1) self.emit("if (%s == NULL) goto failed;" % field.name, depth+1) self.emit("for (i = 0; i < len; i++) {", depth+1) - self.emit("%s value;" % ctype, depth+2) - self.emit("res = obj2ast_%s(PyList_GET_ITEM(tmp, i), &value, arena);" % + self.emit("%s val;" % ctype, depth+2) + self.emit("res = obj2ast_%s(PyList_GET_ITEM(tmp, i), &val, arena);" % field.type, depth+2, reflow=False) self.emit("if (res != 0) goto failed;", depth+2) self.emit("if (len != PyList_GET_SIZE(tmp)) {", depth+2) @@ -533,7 +533,7 @@ def visitField(self, field, name, sum=None, prod=None, depth=0): depth+3, reflow=False) self.emit("goto failed;", depth+3) self.emit("}", depth+2) - self.emit("asdl_seq_SET(%s, i, value);" % field.name, depth+2) + self.emit("asdl_seq_SET(%s, i, val);" % field.name, depth+2) self.emit("}", depth+1) else: self.emit("res = obj2ast_%s(tmp, &%s, arena);" % diff --git a/Python/Python-ast.c b/Python/Python-ast.c index e0607ba9ae6..b78a0fc714e 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -3994,14 +3994,14 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Module field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -4033,14 +4033,14 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Interactive field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -4094,14 +4094,14 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Suite field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -4201,14 +4201,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "FunctionDef field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -4229,14 +4229,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) decorator_list = _Py_asdl_seq_new(len, arena); if (decorator_list == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "FunctionDef field \"decorator_list\" changed size during iteration"); goto failed; } - asdl_seq_SET(decorator_list, i, value); + asdl_seq_SET(decorator_list, i, val); } Py_CLEAR(tmp); } else { @@ -4305,14 +4305,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "AsyncFunctionDef field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -4333,14 +4333,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) decorator_list = _Py_asdl_seq_new(len, arena); if (decorator_list == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "AsyncFunctionDef field \"decorator_list\" changed size during iteration"); goto failed; } - asdl_seq_SET(decorator_list, i, value); + asdl_seq_SET(decorator_list, i, val); } Py_CLEAR(tmp); } else { @@ -4398,14 +4398,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) bases = _Py_asdl_seq_new(len, arena); if (bases == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"bases\" changed size during iteration"); goto failed; } - asdl_seq_SET(bases, i, value); + asdl_seq_SET(bases, i, val); } Py_CLEAR(tmp); } else { @@ -4426,14 +4426,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) keywords = _Py_asdl_seq_new(len, arena); if (keywords == NULL) goto failed; for (i = 0; i < len; i++) { - keyword_ty value; - res = obj2ast_keyword(PyList_GET_ITEM(tmp, i), &value, arena); + keyword_ty val; + res = obj2ast_keyword(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"keywords\" changed size during iteration"); goto failed; } - asdl_seq_SET(keywords, i, value); + asdl_seq_SET(keywords, i, val); } Py_CLEAR(tmp); } else { @@ -4454,14 +4454,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -4482,14 +4482,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) decorator_list = _Py_asdl_seq_new(len, arena); if (decorator_list == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"decorator_list\" changed size during iteration"); goto failed; } - asdl_seq_SET(decorator_list, i, value); + asdl_seq_SET(decorator_list, i, val); } Py_CLEAR(tmp); } else { @@ -4543,14 +4543,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) targets = _Py_asdl_seq_new(len, arena); if (targets == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Delete field \"targets\" changed size during iteration"); goto failed; } - asdl_seq_SET(targets, i, value); + asdl_seq_SET(targets, i, val); } Py_CLEAR(tmp); } else { @@ -4583,14 +4583,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) targets = _Py_asdl_seq_new(len, arena); if (targets == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Assign field \"targets\" changed size during iteration"); goto failed; } - asdl_seq_SET(targets, i, value); + asdl_seq_SET(targets, i, val); } Py_CLEAR(tmp); } else { @@ -4762,14 +4762,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "For field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -4790,14 +4790,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) orelse = _Py_asdl_seq_new(len, arena); if (orelse == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "For field \"orelse\" changed size during iteration"); goto failed; } - asdl_seq_SET(orelse, i, value); + asdl_seq_SET(orelse, i, val); } Py_CLEAR(tmp); } else { @@ -4854,14 +4854,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "AsyncFor field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -4882,14 +4882,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) orelse = _Py_asdl_seq_new(len, arena); if (orelse == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "AsyncFor field \"orelse\" changed size during iteration"); goto failed; } - asdl_seq_SET(orelse, i, value); + asdl_seq_SET(orelse, i, val); } Py_CLEAR(tmp); } else { @@ -4934,14 +4934,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "While field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -4962,14 +4962,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) orelse = _Py_asdl_seq_new(len, arena); if (orelse == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "While field \"orelse\" changed size during iteration"); goto failed; } - asdl_seq_SET(orelse, i, value); + asdl_seq_SET(orelse, i, val); } Py_CLEAR(tmp); } else { @@ -5014,14 +5014,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "If field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -5042,14 +5042,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) orelse = _Py_asdl_seq_new(len, arena); if (orelse == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "If field \"orelse\" changed size during iteration"); goto failed; } - asdl_seq_SET(orelse, i, value); + asdl_seq_SET(orelse, i, val); } Py_CLEAR(tmp); } else { @@ -5082,14 +5082,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) items = _Py_asdl_seq_new(len, arena); if (items == NULL) goto failed; for (i = 0; i < len; i++) { - withitem_ty value; - res = obj2ast_withitem(PyList_GET_ITEM(tmp, i), &value, arena); + withitem_ty val; + res = obj2ast_withitem(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "With field \"items\" changed size during iteration"); goto failed; } - asdl_seq_SET(items, i, value); + asdl_seq_SET(items, i, val); } Py_CLEAR(tmp); } else { @@ -5110,14 +5110,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "With field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -5150,14 +5150,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) items = _Py_asdl_seq_new(len, arena); if (items == NULL) goto failed; for (i = 0; i < len; i++) { - withitem_ty value; - res = obj2ast_withitem(PyList_GET_ITEM(tmp, i), &value, arena); + withitem_ty val; + res = obj2ast_withitem(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "AsyncWith field \"items\" changed size during iteration"); goto failed; } - asdl_seq_SET(items, i, value); + asdl_seq_SET(items, i, val); } Py_CLEAR(tmp); } else { @@ -5178,14 +5178,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "AsyncWith field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -5252,14 +5252,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Try field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -5280,14 +5280,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) handlers = _Py_asdl_seq_new(len, arena); if (handlers == NULL) goto failed; for (i = 0; i < len; i++) { - excepthandler_ty value; - res = obj2ast_excepthandler(PyList_GET_ITEM(tmp, i), &value, arena); + excepthandler_ty val; + res = obj2ast_excepthandler(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Try field \"handlers\" changed size during iteration"); goto failed; } - asdl_seq_SET(handlers, i, value); + asdl_seq_SET(handlers, i, val); } Py_CLEAR(tmp); } else { @@ -5308,14 +5308,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) orelse = _Py_asdl_seq_new(len, arena); if (orelse == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Try field \"orelse\" changed size during iteration"); goto failed; } - asdl_seq_SET(orelse, i, value); + asdl_seq_SET(orelse, i, val); } Py_CLEAR(tmp); } else { @@ -5336,14 +5336,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) finalbody = _Py_asdl_seq_new(len, arena); if (finalbody == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Try field \"finalbody\" changed size during iteration"); goto failed; } - asdl_seq_SET(finalbody, i, value); + asdl_seq_SET(finalbody, i, val); } Py_CLEAR(tmp); } else { @@ -5409,14 +5409,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) names = _Py_asdl_seq_new(len, arena); if (names == NULL) goto failed; for (i = 0; i < len; i++) { - alias_ty value; - res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &value, arena); + alias_ty val; + res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Import field \"names\" changed size during iteration"); goto failed; } - asdl_seq_SET(names, i, value); + asdl_seq_SET(names, i, val); } Py_CLEAR(tmp); } else { @@ -5460,14 +5460,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) names = _Py_asdl_seq_new(len, arena); if (names == NULL) goto failed; for (i = 0; i < len; i++) { - alias_ty value; - res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &value, arena); + alias_ty val; + res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ImportFrom field \"names\" changed size during iteration"); goto failed; } - asdl_seq_SET(names, i, value); + asdl_seq_SET(names, i, val); } Py_CLEAR(tmp); } else { @@ -5509,14 +5509,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) names = _Py_asdl_seq_new(len, arena); if (names == NULL) goto failed; for (i = 0; i < len; i++) { - identifier value; - res = obj2ast_identifier(PyList_GET_ITEM(tmp, i), &value, arena); + identifier val; + res = obj2ast_identifier(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Global field \"names\" changed size during iteration"); goto failed; } - asdl_seq_SET(names, i, value); + asdl_seq_SET(names, i, val); } Py_CLEAR(tmp); } else { @@ -5548,14 +5548,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) names = _Py_asdl_seq_new(len, arena); if (names == NULL) goto failed; for (i = 0; i < len; i++) { - identifier value; - res = obj2ast_identifier(PyList_GET_ITEM(tmp, i), &value, arena); + identifier val; + res = obj2ast_identifier(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Nonlocal field \"names\" changed size during iteration"); goto failed; } - asdl_seq_SET(names, i, value); + asdl_seq_SET(names, i, val); } Py_CLEAR(tmp); } else { @@ -5693,14 +5693,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) values = _Py_asdl_seq_new(len, arena); if (values == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "BoolOp field \"values\" changed size during iteration"); goto failed; } - asdl_seq_SET(values, i, value); + asdl_seq_SET(values, i, val); } Py_CLEAR(tmp); } else { @@ -5893,14 +5893,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) keys = _Py_asdl_seq_new(len, arena); if (keys == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Dict field \"keys\" changed size during iteration"); goto failed; } - asdl_seq_SET(keys, i, value); + asdl_seq_SET(keys, i, val); } Py_CLEAR(tmp); } else { @@ -5921,14 +5921,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) values = _Py_asdl_seq_new(len, arena); if (values == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Dict field \"values\" changed size during iteration"); goto failed; } - asdl_seq_SET(values, i, value); + asdl_seq_SET(values, i, val); } Py_CLEAR(tmp); } else { @@ -5960,14 +5960,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) elts = _Py_asdl_seq_new(len, arena); if (elts == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Set field \"elts\" changed size during iteration"); goto failed; } - asdl_seq_SET(elts, i, value); + asdl_seq_SET(elts, i, val); } Py_CLEAR(tmp); } else { @@ -6011,14 +6011,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) generators = _Py_asdl_seq_new(len, arena); if (generators == NULL) goto failed; for (i = 0; i < len; i++) { - comprehension_ty value; - res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena); + comprehension_ty val; + res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ListComp field \"generators\" changed size during iteration"); goto failed; } - asdl_seq_SET(generators, i, value); + asdl_seq_SET(generators, i, val); } Py_CLEAR(tmp); } else { @@ -6062,14 +6062,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) generators = _Py_asdl_seq_new(len, arena); if (generators == NULL) goto failed; for (i = 0; i < len; i++) { - comprehension_ty value; - res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena); + comprehension_ty val; + res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "SetComp field \"generators\" changed size during iteration"); goto failed; } - asdl_seq_SET(generators, i, value); + asdl_seq_SET(generators, i, val); } Py_CLEAR(tmp); } else { @@ -6125,14 +6125,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) generators = _Py_asdl_seq_new(len, arena); if (generators == NULL) goto failed; for (i = 0; i < len; i++) { - comprehension_ty value; - res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena); + comprehension_ty val; + res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "DictComp field \"generators\" changed size during iteration"); goto failed; } - asdl_seq_SET(generators, i, value); + asdl_seq_SET(generators, i, val); } Py_CLEAR(tmp); } else { @@ -6176,14 +6176,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) generators = _Py_asdl_seq_new(len, arena); if (generators == NULL) goto failed; for (i = 0; i < len; i++) { - comprehension_ty value; - res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena); + comprehension_ty val; + res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "GeneratorExp field \"generators\" changed size during iteration"); goto failed; } - asdl_seq_SET(generators, i, value); + asdl_seq_SET(generators, i, val); } Py_CLEAR(tmp); } else { @@ -6293,14 +6293,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) ops = _Py_asdl_int_seq_new(len, arena); if (ops == NULL) goto failed; for (i = 0; i < len; i++) { - cmpop_ty value; - res = obj2ast_cmpop(PyList_GET_ITEM(tmp, i), &value, arena); + cmpop_ty val; + res = obj2ast_cmpop(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Compare field \"ops\" changed size during iteration"); goto failed; } - asdl_seq_SET(ops, i, value); + asdl_seq_SET(ops, i, val); } Py_CLEAR(tmp); } else { @@ -6321,14 +6321,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) comparators = _Py_asdl_seq_new(len, arena); if (comparators == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Compare field \"comparators\" changed size during iteration"); goto failed; } - asdl_seq_SET(comparators, i, value); + asdl_seq_SET(comparators, i, val); } Py_CLEAR(tmp); } else { @@ -6373,14 +6373,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) args = _Py_asdl_seq_new(len, arena); if (args == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Call field \"args\" changed size during iteration"); goto failed; } - asdl_seq_SET(args, i, value); + asdl_seq_SET(args, i, val); } Py_CLEAR(tmp); } else { @@ -6401,14 +6401,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) keywords = _Py_asdl_seq_new(len, arena); if (keywords == NULL) goto failed; for (i = 0; i < len; i++) { - keyword_ty value; - res = obj2ast_keyword(PyList_GET_ITEM(tmp, i), &value, arena); + keyword_ty val; + res = obj2ast_keyword(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Call field \"keywords\" changed size during iteration"); goto failed; } - asdl_seq_SET(keywords, i, value); + asdl_seq_SET(keywords, i, val); } Py_CLEAR(tmp); } else { @@ -6529,14 +6529,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) values = _Py_asdl_seq_new(len, arena); if (values == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "JoinedStr field \"values\" changed size during iteration"); goto failed; } - asdl_seq_SET(values, i, value); + asdl_seq_SET(values, i, val); } Py_CLEAR(tmp); } else { @@ -6805,14 +6805,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) elts = _Py_asdl_seq_new(len, arena); if (elts == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "List field \"elts\" changed size during iteration"); goto failed; } - asdl_seq_SET(elts, i, value); + asdl_seq_SET(elts, i, val); } Py_CLEAR(tmp); } else { @@ -6856,14 +6856,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) elts = _Py_asdl_seq_new(len, arena); if (elts == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Tuple field \"elts\" changed size during iteration"); goto failed; } - asdl_seq_SET(elts, i, value); + asdl_seq_SET(elts, i, val); } Py_CLEAR(tmp); } else { @@ -7025,14 +7025,14 @@ obj2ast_slice(PyObject* obj, slice_ty* out, PyArena* arena) dims = _Py_asdl_seq_new(len, arena); if (dims == NULL) goto failed; for (i = 0; i < len; i++) { - slice_ty value; - res = obj2ast_slice(PyList_GET_ITEM(tmp, i), &value, arena); + slice_ty val; + res = obj2ast_slice(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ExtSlice field \"dims\" changed size during iteration"); goto failed; } - asdl_seq_SET(dims, i, value); + asdl_seq_SET(dims, i, val); } Py_CLEAR(tmp); } else { @@ -7389,14 +7389,14 @@ obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena* arena) ifs = _Py_asdl_seq_new(len, arena); if (ifs == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "comprehension field \"ifs\" changed size during iteration"); goto failed; } - asdl_seq_SET(ifs, i, value); + asdl_seq_SET(ifs, i, val); } Py_CLEAR(tmp); } else { @@ -7499,14 +7499,14 @@ obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena) body = _Py_asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ExceptHandler field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_CLEAR(tmp); } else { @@ -7549,14 +7549,14 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena) args = _Py_asdl_seq_new(len, arena); if (args == NULL) goto failed; for (i = 0; i < len; i++) { - arg_ty value; - res = obj2ast_arg(PyList_GET_ITEM(tmp, i), &value, arena); + arg_ty val; + res = obj2ast_arg(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "arguments field \"args\" changed size during iteration"); goto failed; } - asdl_seq_SET(args, i, value); + asdl_seq_SET(args, i, val); } Py_CLEAR(tmp); } else { @@ -7587,14 +7587,14 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena) kwonlyargs = _Py_asdl_seq_new(len, arena); if (kwonlyargs == NULL) goto failed; for (i = 0; i < len; i++) { - arg_ty value; - res = obj2ast_arg(PyList_GET_ITEM(tmp, i), &value, arena); + arg_ty val; + res = obj2ast_arg(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "arguments field \"kwonlyargs\" changed size during iteration"); goto failed; } - asdl_seq_SET(kwonlyargs, i, value); + asdl_seq_SET(kwonlyargs, i, val); } Py_CLEAR(tmp); } else { @@ -7615,14 +7615,14 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena) kw_defaults = _Py_asdl_seq_new(len, arena); if (kw_defaults == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "arguments field \"kw_defaults\" changed size during iteration"); goto failed; } - asdl_seq_SET(kw_defaults, i, value); + asdl_seq_SET(kw_defaults, i, val); } Py_CLEAR(tmp); } else { @@ -7653,14 +7653,14 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena) defaults = _Py_asdl_seq_new(len, arena); if (defaults == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "arguments field \"defaults\" changed size during iteration"); goto failed; } - asdl_seq_SET(defaults, i, value); + asdl_seq_SET(defaults, i, val); } Py_CLEAR(tmp); } else { From webhook-mailer at python.org Fri Aug 4 13:54:30 2017 From: webhook-mailer at python.org (=?utf-8?q?=C5=81ukasz?= Langa) Date: Fri, 04 Aug 2017 17:54:30 -0000 Subject: [Python-checkins] Fix a shadow-compatible-local warning (#2182) Message-ID: https://github.com/python/cpython/commit/5fbb8e367d4406f3248a60bed057f3b82d30f9ab commit: 5fbb8e367d4406f3248a60bed057f3b82d30f9ab branch: 2.7 author: Yuan Chao Chou committer: ?ukasz Langa date: 2017-08-04T10:54:27-07:00 summary: Fix a shadow-compatible-local warning (#2182) Change the shadowing naming, 'value' (Python-ast.c:3814), to 'val' to prevent the variables from being misused. files: M Parser/asdl_c.py M Python/Python-ast.c diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py index 2bbd5a0f3c0..08353a9e7f5 100755 --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -509,8 +509,8 @@ def visitField(self, field, name, sum=None, prod=None, depth=0): self.emit("%s = asdl_seq_new(len, arena);" % field.name, depth+1) self.emit("if (%s == NULL) goto failed;" % field.name, depth+1) self.emit("for (i = 0; i < len; i++) {", depth+1) - self.emit("%s value;" % ctype, depth+2) - self.emit("res = obj2ast_%s(PyList_GET_ITEM(tmp, i), &value, arena);" % + self.emit("%s val;" % ctype, depth+2) + self.emit("res = obj2ast_%s(PyList_GET_ITEM(tmp, i), &val, arena);" % field.type, depth+2, reflow=False) self.emit("if (res != 0) goto failed;", depth+2) self.emit("if (len != PyList_GET_SIZE(tmp)) {", depth+2) @@ -520,7 +520,7 @@ def visitField(self, field, name, sum=None, prod=None, depth=0): depth+3, reflow=False) self.emit("goto failed;", depth+3) self.emit("}", depth+2) - self.emit("asdl_seq_SET(%s, i, value);" % field.name, depth+2) + self.emit("asdl_seq_SET(%s, i, val);" % field.name, depth+2) self.emit("}", depth+1) else: self.emit("res = obj2ast_%s(tmp, &%s, arena);" % diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 28c95b0638f..4ac5cf578fb 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -3348,14 +3348,14 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena) body = asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Module field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -3388,14 +3388,14 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena) body = asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Interactive field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -3451,14 +3451,14 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena) body = asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Suite field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -3564,14 +3564,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "FunctionDef field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -3593,14 +3593,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) decorator_list = asdl_seq_new(len, arena); if (decorator_list == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "FunctionDef field \"decorator_list\" changed size during iteration"); goto failed; } - asdl_seq_SET(decorator_list, i, value); + asdl_seq_SET(decorator_list, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -3649,14 +3649,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) bases = asdl_seq_new(len, arena); if (bases == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"bases\" changed size during iteration"); goto failed; } - asdl_seq_SET(bases, i, value); + asdl_seq_SET(bases, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -3678,14 +3678,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -3707,14 +3707,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) decorator_list = asdl_seq_new(len, arena); if (decorator_list == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"decorator_list\" changed size during iteration"); goto failed; } - asdl_seq_SET(decorator_list, i, value); + asdl_seq_SET(decorator_list, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -3770,14 +3770,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) targets = asdl_seq_new(len, arena); if (targets == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Delete field \"targets\" changed size during iteration"); goto failed; } - asdl_seq_SET(targets, i, value); + asdl_seq_SET(targets, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -3811,14 +3811,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) targets = asdl_seq_new(len, arena); if (targets == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Assign field \"targets\" changed size during iteration"); goto failed; } - asdl_seq_SET(targets, i, value); + asdl_seq_SET(targets, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -3925,14 +3925,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) values = asdl_seq_new(len, arena); if (values == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Print field \"values\" changed size during iteration"); goto failed; } - asdl_seq_SET(values, i, value); + asdl_seq_SET(values, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -4004,14 +4004,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "For field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -4033,14 +4033,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) orelse = asdl_seq_new(len, arena); if (orelse == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "For field \"orelse\" changed size during iteration"); goto failed; } - asdl_seq_SET(orelse, i, value); + asdl_seq_SET(orelse, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -4088,14 +4088,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "While field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -4117,14 +4117,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) orelse = asdl_seq_new(len, arena); if (orelse == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "While field \"orelse\" changed size during iteration"); goto failed; } - asdl_seq_SET(orelse, i, value); + asdl_seq_SET(orelse, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -4171,14 +4171,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "If field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -4200,14 +4200,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) orelse = asdl_seq_new(len, arena); if (orelse == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "If field \"orelse\" changed size during iteration"); goto failed; } - asdl_seq_SET(orelse, i, value); + asdl_seq_SET(orelse, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -4265,14 +4265,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "With field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -4354,14 +4354,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "TryExcept field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -4383,14 +4383,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) handlers = asdl_seq_new(len, arena); if (handlers == NULL) goto failed; for (i = 0; i < len; i++) { - excepthandler_ty value; - res = obj2ast_excepthandler(PyList_GET_ITEM(tmp, i), &value, arena); + excepthandler_ty val; + res = obj2ast_excepthandler(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "TryExcept field \"handlers\" changed size during iteration"); goto failed; } - asdl_seq_SET(handlers, i, value); + asdl_seq_SET(handlers, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -4412,14 +4412,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) orelse = asdl_seq_new(len, arena); if (orelse == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "TryExcept field \"orelse\" changed size during iteration"); goto failed; } - asdl_seq_SET(orelse, i, value); + asdl_seq_SET(orelse, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -4454,14 +4454,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) body = asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "TryFinally field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -4483,14 +4483,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) finalbody = asdl_seq_new(len, arena); if (finalbody == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "TryFinally field \"finalbody\" changed size during iteration"); goto failed; } - asdl_seq_SET(finalbody, i, value); + asdl_seq_SET(finalbody, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -4558,14 +4558,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) names = asdl_seq_new(len, arena); if (names == NULL) goto failed; for (i = 0; i < len; i++) { - alias_ty value; - res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &value, arena); + alias_ty val; + res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Import field \"names\" changed size during iteration"); goto failed; } - asdl_seq_SET(names, i, value); + asdl_seq_SET(names, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -4611,14 +4611,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) names = asdl_seq_new(len, arena); if (names == NULL) goto failed; for (i = 0; i < len; i++) { - alias_ty value; - res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &value, arena); + alias_ty val; + res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ImportFrom field \"names\" changed size during iteration"); goto failed; } - asdl_seq_SET(names, i, value); + asdl_seq_SET(names, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -4710,14 +4710,14 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) names = asdl_seq_new(len, arena); if (names == NULL) goto failed; for (i = 0; i < len; i++) { - identifier value; - res = obj2ast_identifier(PyList_GET_ITEM(tmp, i), &value, arena); + identifier val; + res = obj2ast_identifier(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Global field \"names\" changed size during iteration"); goto failed; } - asdl_seq_SET(names, i, value); + asdl_seq_SET(names, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -4862,14 +4862,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) values = asdl_seq_new(len, arena); if (values == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "BoolOp field \"values\" changed size during iteration"); goto failed; } - asdl_seq_SET(values, i, value); + asdl_seq_SET(values, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -5073,14 +5073,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) keys = asdl_seq_new(len, arena); if (keys == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Dict field \"keys\" changed size during iteration"); goto failed; } - asdl_seq_SET(keys, i, value); + asdl_seq_SET(keys, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -5102,14 +5102,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) values = asdl_seq_new(len, arena); if (values == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Dict field \"values\" changed size during iteration"); goto failed; } - asdl_seq_SET(values, i, value); + asdl_seq_SET(values, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -5142,14 +5142,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) elts = asdl_seq_new(len, arena); if (elts == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Set field \"elts\" changed size during iteration"); goto failed; } - asdl_seq_SET(elts, i, value); + asdl_seq_SET(elts, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -5195,14 +5195,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) generators = asdl_seq_new(len, arena); if (generators == NULL) goto failed; for (i = 0; i < len; i++) { - comprehension_ty value; - res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena); + comprehension_ty val; + res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ListComp field \"generators\" changed size during iteration"); goto failed; } - asdl_seq_SET(generators, i, value); + asdl_seq_SET(generators, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -5248,14 +5248,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) generators = asdl_seq_new(len, arena); if (generators == NULL) goto failed; for (i = 0; i < len; i++) { - comprehension_ty value; - res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena); + comprehension_ty val; + res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "SetComp field \"generators\" changed size during iteration"); goto failed; } - asdl_seq_SET(generators, i, value); + asdl_seq_SET(generators, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -5314,14 +5314,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) generators = asdl_seq_new(len, arena); if (generators == NULL) goto failed; for (i = 0; i < len; i++) { - comprehension_ty value; - res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena); + comprehension_ty val; + res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "DictComp field \"generators\" changed size during iteration"); goto failed; } - asdl_seq_SET(generators, i, value); + asdl_seq_SET(generators, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -5368,14 +5368,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) generators = asdl_seq_new(len, arena); if (generators == NULL) goto failed; for (i = 0; i < len; i++) { - comprehension_ty value; - res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena); + comprehension_ty val; + res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "GeneratorExp field \"generators\" changed size during iteration"); goto failed; } - asdl_seq_SET(generators, i, value); + asdl_seq_SET(generators, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -5444,14 +5444,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) ops = asdl_int_seq_new(len, arena); if (ops == NULL) goto failed; for (i = 0; i < len; i++) { - cmpop_ty value; - res = obj2ast_cmpop(PyList_GET_ITEM(tmp, i), &value, arena); + cmpop_ty val; + res = obj2ast_cmpop(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Compare field \"ops\" changed size during iteration"); goto failed; } - asdl_seq_SET(ops, i, value); + asdl_seq_SET(ops, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -5473,14 +5473,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) comparators = asdl_seq_new(len, arena); if (comparators == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Compare field \"comparators\" changed size during iteration"); goto failed; } - asdl_seq_SET(comparators, i, value); + asdl_seq_SET(comparators, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -5530,14 +5530,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) args = asdl_seq_new(len, arena); if (args == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Call field \"args\" changed size during iteration"); goto failed; } - asdl_seq_SET(args, i, value); + asdl_seq_SET(args, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -5559,14 +5559,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) keywords = asdl_seq_new(len, arena); if (keywords == NULL) goto failed; for (i = 0; i < len; i++) { - keyword_ty value; - res = obj2ast_keyword(PyList_GET_ITEM(tmp, i), &value, arena); + keyword_ty val; + res = obj2ast_keyword(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Call field \"keywords\" changed size during iteration"); goto failed; } - asdl_seq_SET(keywords, i, value); + asdl_seq_SET(keywords, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -5826,14 +5826,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) elts = asdl_seq_new(len, arena); if (elts == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "List field \"elts\" changed size during iteration"); goto failed; } - asdl_seq_SET(elts, i, value); + asdl_seq_SET(elts, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -5879,14 +5879,14 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) elts = asdl_seq_new(len, arena); if (elts == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "Tuple field \"elts\" changed size during iteration"); goto failed; } - asdl_seq_SET(elts, i, value); + asdl_seq_SET(elts, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -6070,14 +6070,14 @@ obj2ast_slice(PyObject* obj, slice_ty* out, PyArena* arena) dims = asdl_seq_new(len, arena); if (dims == NULL) goto failed; for (i = 0; i < len; i++) { - slice_ty value; - res = obj2ast_slice(PyList_GET_ITEM(tmp, i), &value, arena); + slice_ty val; + res = obj2ast_slice(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ExtSlice field \"dims\" changed size during iteration"); goto failed; } - asdl_seq_SET(dims, i, value); + asdl_seq_SET(dims, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -6451,14 +6451,14 @@ obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena* arena) ifs = asdl_seq_new(len, arena); if (ifs == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "comprehension field \"ifs\" changed size during iteration"); goto failed; } - asdl_seq_SET(ifs, i, value); + asdl_seq_SET(ifs, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -6555,14 +6555,14 @@ obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena) body = asdl_seq_new(len, arena); if (body == NULL) goto failed; for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); + stmt_ty val; + res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "ExceptHandler field \"body\" changed size during iteration"); goto failed; } - asdl_seq_SET(body, i, value); + asdl_seq_SET(body, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -6607,14 +6607,14 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena) args = asdl_seq_new(len, arena); if (args == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "arguments field \"args\" changed size during iteration"); goto failed; } - asdl_seq_SET(args, i, value); + asdl_seq_SET(args, i, val); } Py_XDECREF(tmp); tmp = NULL; @@ -6658,14 +6658,14 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena) defaults = asdl_seq_new(len, arena); if (defaults == NULL) goto failed; for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + expr_ty val; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena); if (res != 0) goto failed; if (len != PyList_GET_SIZE(tmp)) { PyErr_SetString(PyExc_RuntimeError, "arguments field \"defaults\" changed size during iteration"); goto failed; } - asdl_seq_SET(defaults, i, value); + asdl_seq_SET(defaults, i, val); } Py_XDECREF(tmp); tmp = NULL; From webhook-mailer at python.org Fri Aug 4 14:21:42 2017 From: webhook-mailer at python.org (=?utf-8?q?=C5=81ukasz?= Langa) Date: Fri, 04 Aug 2017 18:21:42 -0000 Subject: [Python-checkins] Add author of the fix for #30841 to ACKS. (#3001) Message-ID: https://github.com/python/cpython/commit/8238ef0467f210146a7aecfdc52dbe703d3e190d commit: 8238ef0467f210146a7aecfdc52dbe703d3e190d branch: master author: ?ukasz Langa committer: GitHub date: 2017-08-04T11:21:37-07:00 summary: Add author of the fix for #30841 to ACKS. (#3001) files: M Misc/ACKS diff --git a/Misc/ACKS b/Misc/ACKS index ec7d481a587..e340392d8e1 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -273,6 +273,7 @@ Adal Chiriliuc Matt Chisholm Lita Cho Sayan Chowdhury +Yuan-Chao Chou Anders Chrigstr?m Tom Christiansen Renee Chu From lp_benchmark_robot at intel.com Fri Aug 4 16:58:00 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 4 Aug 2017 13:58:00 -0700 Subject: [Python-checkins] [1 down, 1 up, 63 flat] Results for Python (master branch) 2017-08-04 Message-ID: Results for project python/master, build date: 2017-08-04 03:03:31-07:00. - commit: c4c9866 - previous commit: 5075416 - revision date: 2017-08-04 11:45:00+03:00 - environment: Broadwell-EP - cpu: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz 2x22 cores, stepping 1, LLC 55 MB - mem: 128 GB - os: Ubuntu 16.04.2 LTS - kernel: 4.4.0-62-generic x86_64 GNU/Linux Baseline results were generated using release v3.6.0, with hash 5c4568a from 2016-12-22 23:38:47+00:00. +-----+------------------------+--------+------------+------------+------------+ | | |relative|change since|change since|current rev | | | benchmark|std_dev*| last run | baseline |run with PGO| +-----+------------------------+--------+------------+------------+------------+ | :-| | 2to3| 1.098% | -0.312% | +3.941% | +8.632% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method| 0.942% | -0.179% | +22.114% | +10.972% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_slots| 2.203% | +0.067% | +23.825% | +10.472% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_unknown| 0.777% | -0.778% | +20.991% | +11.948% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_simple| 2.700% | -3.094% | +2.761% | +15.830% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chameleon| 1.511% | -0.828% | +10.899% | +11.437% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chaos| 1.436% | -1.479% | +6.284% | +12.922% | +-----+------------------------+--------+------------+------------+------------+ | :-| | crypto_pyaes| 0.498% | +0.103% | +4.534% | +5.309% | +-----+------------------------+--------+------------+------------+------------+ | :-| | deltablue| 4.161% | -3.358% | +6.894% | +20.441% | +-----+------------------------+--------+------------+------------+------------+ | :-| | django_template| 4.578% | -1.291% | +8.711% | +14.295% | +-----+------------------------+--------+------------+------------+------------+ | :-| | dulwich_log| 1.214% | +1.289% | +4.425% | +6.275% | +-----+------------------------+--------+------------+------------+------------+ | :-| | fannkuch| 0.683% | -1.881% | +4.817% | +5.438% | +-----+------------------------+--------+------------+------------+------------+ | :-| | float| 0.789% | -1.443% | +3.054% | +6.299% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_text| 1.230% | -0.331% | +9.005% | +11.309% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_xml| 2.851% | -2.366% | +6.285% | +11.557% | +-----+------------------------+--------+------------+------------+------------+ | :-| | go| 0.691% | -1.098% | +6.079% | +11.582% | +-----+------------------------+--------+------------+------------+------------+ | :-| | hexiom| 1.372% | -0.472% | +8.849% | +13.336% | +-----+------------------------+--------+------------+------------+------------+ | :-| | html5lib| 3.512% | -2.107% | +6.998% | +11.236% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_dumps| 2.509% | -0.777% | +3.853% | +9.696% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_loads| 2.707% | -2.053% | +2.678% | +9.946% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_format| 1.696% | -0.378% | +8.131% | +12.713% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_silent| 3.075% | -1.261% | +46.839% | +12.069% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_simple| 1.450% | -0.130% | +9.498% | +13.759% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mako| 0.385% | -0.759% | +18.945% | +11.979% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mdp| 5.324% | +5.374% | +6.136% | +13.424% | +-----+------------------------+--------+------------+------------+------------+ | :-| | meteor_contest| 2.169% | -0.212% | +3.939% | +5.915% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nbody| 0.579% | +0.232% | -2.057% | +4.325% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nqueens| 1.095% | -1.086% | +2.828% | +7.474% | +-----+------------------------+--------+------------+------------+------------+ | :-) | pathlib| 1.252% | +6.322% | +5.502% | +9.363% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle| 2.859% | -0.061% | +1.674% | +23.657% | +-----+------------------------+--------+------------+------------+------------+ | :-( | pickle_dict| 0.760% | -2.342% | +2.451% | +22.887% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_list| 0.908% | -0.311% | +4.883% | +21.107% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_pure_python| 5.752% | -2.055% | +10.996% | +10.386% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pidigits| 0.207% | -0.090% | +0.284% | +9.547% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup| 0.122% | -0.627% | +9.147% | +4.747% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup_no_site| 0.090% | -0.597% | +0.898% | +4.531% | +-----+------------------------+--------+------------+------------+------------+ | :-| | raytrace| 1.238% | -1.033% | +9.569% | +14.639% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_compile| 4.832% | -1.647% | -10.677% | +14.140% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_dna| 0.989% | -0.568% | +1.479% | +9.552% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_effbot| 2.286% | +0.378% | +0.691% | +3.810% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_v8| 0.701% | +0.061% | +11.442% | +4.773% | +-----+------------------------+--------+------------+------------+------------+ | :-| | richards| 1.282% | +0.523% | +7.896% | +15.522% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_fft| 0.773% | +0.828% | +0.687% | +4.451% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_lu| 2.791% | -1.504% | +26.731% | +9.549% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_monte_carlo| 2.243% | -3.620% | +2.383% | +9.022% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sor| 1.741% | -2.898% | +13.119% | +11.079% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sparse_mat_mult| 0.516% | -0.970% | -0.220% | +2.584% | +-----+------------------------+--------+------------+------------+------------+ | :-| | spectral_norm| 0.374% | +0.611% | +5.748% | +3.244% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_declarative| 1.304% | -0.281% | +5.042% | +9.123% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_imperative| 3.536% | -0.295% | +4.976% | +4.929% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlite_synth| 4.608% | -0.474% | +2.167% | +7.475% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_expand| 2.247% | -0.149% | +12.537% | +8.284% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_integrate| 1.998% | -0.790% | +9.926% | +7.557% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_str| 3.684% | -0.014% | +12.213% | +9.730% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_sum| 4.423% | -0.771% | +13.288% | +10.747% | +-----+------------------------+--------+------------+------------+------------+ | :-| | telco| 2.661% | +0.288% | +24.257% | +9.238% | +-----+------------------------+--------+------------+------------+------------+ | :-| | tornado_http| 1.075% | -0.132% | +5.622% | +7.188% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpack_sequence| 1.308% | +0.775% | +0.619% | -0.366% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle| 8.083% | -2.553% | +8.699% | +20.365% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_list| 0.529% | +0.455% | -2.182% | +18.109% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_pure_python| 2.017% | -0.613% | +6.870% | +7.464% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_generate| 1.058% | +0.223% | +5.926% | +9.202% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_iterparse| 2.178% | +0.013% | +1.833% | +6.274% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_parse| 1.649% | +0.330% | -5.450% | +11.999% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_process| 1.242% | -0.048% | +6.372% | +9.041% | +-----+------------------------+--------+------------+------------+------------+ * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/1-down-1-up-63-flat-results-for-python-master-branch-2017-08-04 Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From webhook-mailer at python.org Fri Aug 4 17:14:35 2017 From: webhook-mailer at python.org (Brett Cannon) Date: Fri, 04 Aug 2017 21:14:35 -0000 Subject: [Python-checkins] Notify the import-team on import-related PRs (GH-3002) Message-ID: https://github.com/python/cpython/commit/d255fea7c7cf91f589003a997ad38c7f4c0825a9 commit: d255fea7c7cf91f589003a997ad38c7f4c0825a9 branch: master author: Brett Cannon committer: GitHub date: 2017-08-04T14:14:32-07:00 summary: Notify the import-team on import-related PRs (GH-3002) files: M .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 1c5164f6640..550c9564fca 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -15,7 +15,7 @@ **/*pyhash* @tiran # Import (including importlib) -**/*import* @brettcannon +**/*import* @python/import-team # SSL **/*ssl* @tiran From webhook-mailer at python.org Fri Aug 4 22:00:09 2017 From: webhook-mailer at python.org (Gregory P. Smith) Date: Sat, 05 Aug 2017 02:00:09 -0000 Subject: [Python-checkins] add myself to CODEOWNERS for subprocess. (#3005) Message-ID: https://github.com/python/cpython/commit/60a6632a3d2b2dde1c01850f0aa36a22c8dec8dd commit: 60a6632a3d2b2dde1c01850f0aa36a22c8dec8dd branch: master author: Gregory P. Smith committer: GitHub date: 2017-08-04T20:00:06-06:00 summary: add myself to CODEOWNERS for subprocess. (#3005) files: M .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 550c9564fca..cdb9feee57b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -26,3 +26,6 @@ **/*mime* @bitdancer **/*imap* @bitdancer **/*poplib* @bitdancer + +# subprocess +**/*subprocess* @gpshead From solipsis at pitrou.net Sat Aug 5 05:08:21 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 05 Aug 2017 09:08:21 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=15 Message-ID: <20170805090821.74578.6F8D6D04B0717C8A@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_asyncio leaked [3, 0, 0] memory blocks, sum=3 test_collections leaked [7, -7, 8] memory blocks, sum=8 test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogf5PHBi', '--timeout', '7200'] From webhook-mailer at python.org Sat Aug 5 11:01:14 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Sat, 05 Aug 2017 15:01:14 -0000 Subject: [Python-checkins] [3.6] bpo-31107: Fix copyreg mangled slot names calculation. (GH-2989) (#3003) Message-ID: https://github.com/python/cpython/commit/4795ba857ef2a89e6b477285df961672106a1792 commit: 4795ba857ef2a89e6b477285df961672106a1792 branch: 3.6 author: Shane Harvey committer: Serhiy Storchaka date: 2017-08-05T18:01:10+03:00 summary: [3.6] bpo-31107: Fix copyreg mangled slot names calculation. (GH-2989) (#3003) (cherry picked from commit c4c9866064f03646c686d7e08b00aeb203c35c19) files: A Misc/NEWS.d/next/Library/2017-08-02-12-48-15.bpo-31107.1t2hn5.rst M Lib/copyreg.py M Lib/test/test_copyreg.py M Misc/ACKS diff --git a/Lib/copyreg.py b/Lib/copyreg.py index 67f5bb029ee..cef9984b192 100644 --- a/Lib/copyreg.py +++ b/Lib/copyreg.py @@ -128,7 +128,11 @@ class found there. (This assumes classes don't modify their continue # mangled names elif name.startswith('__') and not name.endswith('__'): - names.append('_%s%s' % (c.__name__, name)) + stripped = c.__name__.lstrip('_') + if stripped: + names.append('_%s%s' % (stripped, name)) + else: + names.append(name) else: names.append(name) diff --git a/Lib/test/test_copyreg.py b/Lib/test/test_copyreg.py index 52e887cb36c..e3f1cd81aab 100644 --- a/Lib/test/test_copyreg.py +++ b/Lib/test/test_copyreg.py @@ -16,6 +16,12 @@ class WithWeakref(object): class WithPrivate(object): __slots__ = ('__spam',) +class _WithLeadingUnderscoreAndPrivate(object): + __slots__ = ('__spam',) + +class ___(object): + __slots__ = ('__spam',) + class WithSingleString(object): __slots__ = 'spam' @@ -104,6 +110,10 @@ def test_slotnames(self): self.assertEqual(copyreg._slotnames(WithWeakref), []) expected = ['_WithPrivate__spam'] self.assertEqual(copyreg._slotnames(WithPrivate), expected) + expected = ['_WithLeadingUnderscoreAndPrivate__spam'] + self.assertEqual(copyreg._slotnames(_WithLeadingUnderscoreAndPrivate), + expected) + self.assertEqual(copyreg._slotnames(___), ['__spam']) self.assertEqual(copyreg._slotnames(WithSingleString), ['spam']) expected = ['eggs', 'spam'] expected.sort() diff --git a/Misc/ACKS b/Misc/ACKS index 7bc13ff0c9e..20e174384ba 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -592,6 +592,7 @@ David Harrigan Brian Harring Jonathan Hartley Travis B. Hartwell +Shane Harvey Larry Hastings Tim Hatch Shane Hathaway diff --git a/Misc/NEWS.d/next/Library/2017-08-02-12-48-15.bpo-31107.1t2hn5.rst b/Misc/NEWS.d/next/Library/2017-08-02-12-48-15.bpo-31107.1t2hn5.rst new file mode 100644 index 00000000000..3c2a15528d8 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-08-02-12-48-15.bpo-31107.1t2hn5.rst @@ -0,0 +1,2 @@ +Fix `copyreg._slotnames()` mangled attribute calculation for classes whose +name begins with an underscore. Patch by Shane Harvey. From webhook-mailer at python.org Sat Aug 5 11:03:04 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Sat, 05 Aug 2017 15:03:04 -0000 Subject: [Python-checkins] [2.7] bpo-31107: Fix copyreg mangled slot names calculation. (GH-2989). (#3004) Message-ID: https://github.com/python/cpython/commit/88ffff5ddbb8692ecb2c661aa29000dbde9eff8c commit: 88ffff5ddbb8692ecb2c661aa29000dbde9eff8c branch: 2.7 author: Shane Harvey committer: Serhiy Storchaka date: 2017-08-05T18:03:01+03:00 summary: [2.7] bpo-31107: Fix copyreg mangled slot names calculation. (GH-2989). (#3004) (cherry picked from commit c4c9866064f03646c686d7e08b00aeb203c35c19) files: A Misc/NEWS.d/next/Library/2017-08-02-12-48-15.bpo-31107.1t2hn5.rst M Lib/copy_reg.py M Lib/test/test_copy_reg.py M Misc/ACKS diff --git a/Lib/copy_reg.py b/Lib/copy_reg.py index db1715092c5..8943077593d 100644 --- a/Lib/copy_reg.py +++ b/Lib/copy_reg.py @@ -127,7 +127,11 @@ class found there. (This assumes classes don't modify their continue # mangled names elif name.startswith('__') and not name.endswith('__'): - names.append('_%s%s' % (c.__name__, name)) + stripped = c.__name__.lstrip('_') + if stripped: + names.append('_%s%s' % (stripped, name)) + else: + names.append(name) else: names.append(name) diff --git a/Lib/test/test_copy_reg.py b/Lib/test/test_copy_reg.py index 8cdb8b7d2ab..17ccbd084d6 100644 --- a/Lib/test/test_copy_reg.py +++ b/Lib/test/test_copy_reg.py @@ -17,6 +17,12 @@ class WithWeakref(object): class WithPrivate(object): __slots__ = ('__spam',) +class _WithLeadingUnderscoreAndPrivate(object): + __slots__ = ('__spam',) + +class ___(object): + __slots__ = ('__spam',) + class WithSingleString(object): __slots__ = 'spam' @@ -105,6 +111,10 @@ def test_slotnames(self): self.assertEqual(copy_reg._slotnames(WithWeakref), []) expected = ['_WithPrivate__spam'] self.assertEqual(copy_reg._slotnames(WithPrivate), expected) + expected = ['_WithLeadingUnderscoreAndPrivate__spam'] + self.assertEqual(copy_reg._slotnames(_WithLeadingUnderscoreAndPrivate), + expected) + self.assertEqual(copy_reg._slotnames(___), ['__spam']) self.assertEqual(copy_reg._slotnames(WithSingleString), ['spam']) expected = ['eggs', 'spam'] expected.sort() diff --git a/Misc/ACKS b/Misc/ACKS index 662db9f40f7..229a874ffc2 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -543,6 +543,7 @@ David Harrigan Brian Harring Jonathan Hartley Travis B. Hartwell +Shane Harvey Larry Hastings Tim Hatch Shane Hathaway diff --git a/Misc/NEWS.d/next/Library/2017-08-02-12-48-15.bpo-31107.1t2hn5.rst b/Misc/NEWS.d/next/Library/2017-08-02-12-48-15.bpo-31107.1t2hn5.rst new file mode 100644 index 00000000000..09807058b4c --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-08-02-12-48-15.bpo-31107.1t2hn5.rst @@ -0,0 +1,2 @@ +Fix `copy_reg._slotnames()` mangled attribute calculation for classes whose +name begins with an underscore. Patch by Shane Harvey. From webhook-mailer at python.org Sat Aug 5 14:28:20 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Sat, 05 Aug 2017 18:28:20 -0000 Subject: [Python-checkins] bpo-31029: test_tokenize Add missing import unittest (#2998) Message-ID: https://github.com/python/cpython/commit/9cd0ef8f3b93818f0ee5318cb1fc9a1ea32e95b6 commit: 9cd0ef8f3b93818f0ee5318cb1fc9a1ea32e95b6 branch: 3.6 author: Rajath Agasthya committer: Serhiy Storchaka date: 2017-08-05T21:28:17+03:00 summary: bpo-31029: test_tokenize Add missing import unittest (#2998) files: M Lib/test/test_tokenize.py diff --git a/Lib/test/test_tokenize.py b/Lib/test/test_tokenize.py index 5a81a5f11a4..10e0ad80779 100644 --- a/Lib/test/test_tokenize.py +++ b/Lib/test/test_tokenize.py @@ -3,6 +3,7 @@ STRING, ENDMARKER, ENCODING, tok_name, detect_encoding, open as tokenize_open, Untokenizer) from io import BytesIO +import unittest from unittest import TestCase, mock from test.test_grammar import (VALID_UNDERSCORE_LITERALS, INVALID_UNDERSCORE_LITERALS) From solipsis at pitrou.net Sun Aug 6 05:07:10 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 06 Aug 2017 09:07:10 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=11 Message-ID: <20170806090710.105420.54BDEA85F6482E4A@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [0, 0, 7] memory blocks, sum=7 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_spawn leaked [-2, 1, 1] memory blocks, sum=0 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogDZJc6Q', '--timeout', '7200'] From webhook-mailer at python.org Sun Aug 6 13:32:42 2017 From: webhook-mailer at python.org (Antoine Pitrou) Date: Sun, 06 Aug 2017 17:32:42 -0000 Subject: [Python-checkins] [3.6] bpo-30808: Use _Py_atomic API for concurrency-sensitive signal state (GH-2417) (#3007) Message-ID: https://github.com/python/cpython/commit/57e836cb41656ac23042886db6b5985c036a7ce2 commit: 57e836cb41656ac23042886db6b5985c036a7ce2 branch: 3.6 author: Antoine Pitrou committer: GitHub date: 2017-08-06T19:32:39+02:00 summary: [3.6] bpo-30808: Use _Py_atomic API for concurrency-sensitive signal state (GH-2417) (#3007) * Improve signal delivery Avoid using Py_AddPendingCall from signal handler, to avoid calling signal-unsafe functions. * Remove unused function * Improve comments * Use _Py_atomic API for concurrency-sensitive signal state * Add blurb (cherry picked from commit 2c8a5e4c968217f9672340e520942c4ed788d8de) files: A Misc/NEWS.d/next/Core and Builtins/2017-07-17-12-12-59.bpo-30808.bA3zOv.rst M Modules/signalmodule.c diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-07-17-12-12-59.bpo-30808.bA3zOv.rst b/Misc/NEWS.d/next/Core and Builtins/2017-07-17-12-12-59.bpo-30808.bA3zOv.rst new file mode 100644 index 00000000000..8adbbe7dc3a --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-07-17-12-12-59.bpo-30808.bA3zOv.rst @@ -0,0 +1 @@ +Use _Py_atomic API for concurrency-sensitive signal state. diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index 30990f89c3e..0e6099fd361 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -93,7 +93,7 @@ static pid_t main_pid; #endif static volatile struct { - sig_atomic_t tripped; + _Py_atomic_int tripped; PyObject *func; } Handlers[NSIG]; @@ -113,7 +113,7 @@ static volatile sig_atomic_t wakeup_fd = -1; #endif /* Speed up sigcheck() when none tripped */ -static volatile sig_atomic_t is_tripped = 0; +static _Py_atomic_int is_tripped; static PyObject *DefaultHandler; static PyObject *IgnoreHandler; @@ -240,11 +240,13 @@ trip_signal(int sig_num) int fd; Py_ssize_t rc; - Handlers[sig_num].tripped = 1; + _Py_atomic_store_relaxed(&Handlers[sig_num].tripped, 1); /* Set is_tripped after setting .tripped, as it gets cleared in PyErr_CheckSignals() before .tripped. */ - is_tripped = 1; + _Py_atomic_store(&is_tripped, 1); + + /* Notify ceval.c */ _PyEval_SignalReceived(); /* And then write to the wakeup fd *after* setting all the globals and @@ -465,7 +467,7 @@ signal_signal_impl(PyObject *module, int signalnum, PyObject *handler) return NULL; } old_handler = Handlers[signalnum].func; - Handlers[signalnum].tripped = 0; + _Py_atomic_store_relaxed(&Handlers[signalnum].tripped, 0); Py_INCREF(handler); Handlers[signalnum].func = handler; if (old_handler != NULL) @@ -1264,11 +1266,11 @@ PyInit__signal(void) goto finally; Py_INCREF(IntHandler); - Handlers[0].tripped = 0; + _Py_atomic_store_relaxed(&Handlers[0].tripped, 0); for (i = 1; i < NSIG; i++) { void (*t)(int); t = PyOS_getsig(i); - Handlers[i].tripped = 0; + _Py_atomic_store_relaxed(&Handlers[i].tripped, 0); if (t == SIG_DFL) Handlers[i].func = DefaultHandler; else if (t == SIG_IGN) @@ -1492,7 +1494,7 @@ finisignal(void) for (i = 1; i < NSIG; i++) { func = Handlers[i].func; - Handlers[i].tripped = 0; + _Py_atomic_store_relaxed(&Handlers[i].tripped, 0); Handlers[i].func = NULL; if (i != SIGINT && func != NULL && func != Py_None && func != DefaultHandler && func != IgnoreHandler) @@ -1513,7 +1515,7 @@ PyErr_CheckSignals(void) int i; PyObject *f; - if (!is_tripped) + if (!_Py_atomic_load(&is_tripped)) return 0; #ifdef WITH_THREAD @@ -1535,16 +1537,16 @@ PyErr_CheckSignals(void) * we receive a signal i after we zero is_tripped and before we * check Handlers[i].tripped. */ - is_tripped = 0; + _Py_atomic_store(&is_tripped, 0); if (!(f = (PyObject *)PyEval_GetFrame())) f = Py_None; for (i = 1; i < NSIG; i++) { - if (Handlers[i].tripped) { + if (_Py_atomic_load_relaxed(&Handlers[i].tripped)) { PyObject *result = NULL; PyObject *arglist = Py_BuildValue("(iO)", i, f); - Handlers[i].tripped = 0; + _Py_atomic_store_relaxed(&Handlers[i].tripped, 0); if (arglist) { result = PyEval_CallObject(Handlers[i].func, @@ -1552,7 +1554,7 @@ PyErr_CheckSignals(void) Py_DECREF(arglist); } if (!result) { - is_tripped = 1; + _Py_atomic_store(&is_tripped, 1); return -1; } @@ -1591,12 +1593,12 @@ PyOS_FiniInterrupts(void) int PyOS_InterruptOccurred(void) { - if (Handlers[SIGINT].tripped) { + if (_Py_atomic_load_relaxed(&Handlers[SIGINT].tripped)) { #ifdef WITH_THREAD if (PyThread_get_thread_ident() != main_thread) return 0; #endif - Handlers[SIGINT].tripped = 0; + _Py_atomic_store_relaxed(&Handlers[SIGINT].tripped, 0); return 1; } return 0; @@ -1606,11 +1608,11 @@ static void _clear_pending_signals(void) { int i; - if (!is_tripped) + if (!_Py_atomic_load(&is_tripped)) return; - is_tripped = 0; + _Py_atomic_store(&is_tripped, 0); for (i = 1; i < NSIG; ++i) { - Handlers[i].tripped = 0; + _Py_atomic_store_relaxed(&Handlers[i].tripped, 0); } } From webhook-mailer at python.org Mon Aug 7 04:27:24 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Mon, 07 Aug 2017 08:27:24 -0000 Subject: [Python-checkins] bpo-31045: Language switch (#2652) Message-ID: https://github.com/python/cpython/commit/dff9b5f9d62aa0b23f8a255867d09d11890efd1b commit: dff9b5f9d62aa0b23f8a255867d09d11890efd1b branch: master author: Julien committer: Victor Stinner date: 2017-08-07T10:27:21+02:00 summary: bpo-31045: Language switch (#2652) * Doc: Indicate the language * Renaming version_switcher to switchers (to add language_switcher). * Adding language switch. * Doc switchers: Enhance readability of regex parsing versions. * Doc switchers: Desambiguate the need of a replace(/\/+$/g, '') by proper naming. * Doc switchers: py3k can't reach js, it's redirected server-side by nginx. * Doc switchers: Examples matching actual regexes. * Doc switchers: Better fallback on unexisting translated version. files: A Doc/tools/static/switchers.js D Doc/tools/static/version_switch.js M Doc/Makefile M Doc/tools/templates/layout.html diff --git a/Doc/Makefile b/Doc/Makefile index ae59f3294f1..526269d1e19 100644 --- a/Doc/Makefile +++ b/Doc/Makefile @@ -167,12 +167,12 @@ serve: # for development releases: always build autobuild-dev: - make dist SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1 -A versionswitcher=1' + make dist SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1 -A switchers=1' -make suspicious # for quick rebuilds (HTML only) autobuild-dev-html: - make html SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1 -A versionswitcher=1' + make html SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1 -A switchers=1' # for stable releases: only build if not in pre-release stage (alpha, beta) # release candidate downloads are okay, since the stable tree can be in that stage diff --git a/Doc/tools/static/switchers.js b/Doc/tools/static/switchers.js new file mode 100644 index 00000000000..470ff6d33b7 --- /dev/null +++ b/Doc/tools/static/switchers.js @@ -0,0 +1,146 @@ +(function() { + 'use strict'; + + // Parses versions in URL segments like: + // "3", "dev", "release/2.7" or "3.6rc2" + var version_regexs = [ + '(?:\\d)', + '(?:\\d\\.\\d[\\w\\d\\.]*)', + '(?:dev)', + '(?:release/\\d.\\d[\\x\\d\\.]*)']; + + var all_versions = { + '3.7': 'dev (3.7)', + '3.6': '3.6', + '3.5': '3.5', + '3.4': '3.4', + '3.3': '3.3', + '2.7': '2.7', + }; + + var all_languages = { + 'en': 'English', + 'fr': 'Fran?ais', + }; + + function build_version_select(current_version, current_release) { + var buf = [''); + return buf.join(''); + } + + function build_language_select(current_language) { + var buf = [''); + return buf.join(''); + } + + function navigate_to_first_existing(urls) { + // Navigate to the first existing URL in urls. + var url = urls.shift(); + if (urls.length == 0) { + window.location.href = url; + return; + } + $.ajax({ + url: url, + success: function() { + window.location.href = url; + }, + error: function() { + navigate_to_first_existing(urls); + } + }); + } + + function on_version_switch() { + var selected_version = $(this).children('option:selected').attr('value') + '/'; + var url = window.location.href; + var current_language = language_segment_from_url(url); + var current_version = version_segment_in_url(url); + var new_url = url.replace('.org/' + current_language + current_version, + '.org/' + current_language + selected_version); + if (new_url != url) { + navigate_to_first_existing([ + new_url, + url.replace('.org/' + current_language + current_version, + '.org/' + selected_version), + 'https://docs.python.org/' + current_language + selected_version, + 'https://docs.python.org/' + selected_version, + 'https://docs.python.org/' + ]); + } + } + + function on_language_switch() { + var selected_language = $(this).children('option:selected').attr('value') + '/'; + var url = window.location.href; + var current_language = language_segment_from_url(url); + var current_version = version_segment_in_url(url); + if (selected_language == 'en/') // Special 'default' case for english. + selected_language = ''; + var new_url = url.replace('.org/' + current_language + current_version, + '.org/' + selected_language + current_version); + if (new_url != url) { + navigate_to_first_existing([ + new_url, + 'https://docs.python.org/' + ]); + } + } + + // Returns the path segment of the language as a string, like 'fr/' + // or '' if not found. + function language_segment_from_url(url) { + var language_regexp = '\.org/(' + Object.keys(all_languages).join('|') + '/)'; + var match = url.match(language_regexp); + if (match !== null) + return match[1]; + return ''; + } + + // Returns the path segment of the version as a string, like '3.6/' + // or '' if not found. + function version_segment_in_url(url) { + var language_segment = '(?:(?:' + Object.keys(all_languages).join('|') + ')/)'; + var version_segment = '(?:(?:' + version_regexs.join('|') + ')/)'; + var version_regexp = '\\.org/' + language_segment + '?(' + version_segment + ')'; + var match = url.match(version_regexp); + if (match !== null) + return match[1]; + return '' + } + + $(document).ready(function() { + var release = DOCUMENTATION_OPTIONS.VERSION; + var language_segment = language_segment_from_url(window.location.href); + var current_language = language_segment.replace(/\/+$/g, '') || 'en'; + var version = release.substr(0, 3); + var version_select = build_version_select(version, release); + + $('.version_switcher_placeholder').html(version_select); + $('.version_switcher_placeholder select').bind('change', on_version_switch); + + var language_select = build_language_select(current_language); + + $('.language_switcher_placeholder').html(language_select); + $('.language_switcher_placeholder select').bind('change', on_language_switch); + }); +})(); diff --git a/Doc/tools/static/version_switch.js b/Doc/tools/static/version_switch.js deleted file mode 100644 index 8b36a616718..00000000000 --- a/Doc/tools/static/version_switch.js +++ /dev/null @@ -1,67 +0,0 @@ -(function() { - 'use strict'; - - var all_versions = { - '3.7': 'dev (3.7)', - '3.6': '3.6', - '3.5': '3.5', - '3.4': '3.4', - '3.3': '3.3', - '2.7': '2.7', - }; - - function build_select(current_version, current_release) { - var buf = [''); - return buf.join(''); - } - - function patch_url(url, new_version) { - var url_re = /\.org\/(\d|py3k|dev|((release\/)?\d\.\d[\w\d\.]*))\//, - new_url = url.replace(url_re, '.org/' + new_version + '/'); - - if (new_url == url && !new_url.match(url_re)) { - // python 2 url without version? - new_url = url.replace(/\.org\//, '.org/' + new_version + '/'); - } - return new_url; - } - - function on_switch() { - var selected = $(this).children('option:selected').attr('value'); - - var url = window.location.href, - new_url = patch_url(url, selected); - - if (new_url != url) { - // check beforehand if url exists, else redirect to version's start page - $.ajax({ - url: new_url, - success: function() { - window.location.href = new_url; - }, - error: function() { - window.location.href = 'https://docs.python.org/' + selected; - } - }); - } - } - - $(document).ready(function() { - var release = DOCUMENTATION_OPTIONS.VERSION; - var version = release.substr(0, 3); - var select = build_select(version, release); - - $('.version_switcher_placeholder').html(select); - $('.version_switcher_placeholder select').bind('change', on_switch); - }); -})(); diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html index 640d8b30493..c2106678ac6 100644 --- a/Doc/tools/templates/layout.html +++ b/Doc/tools/templates/layout.html @@ -4,7 +4,8 @@ style="vertical-align: middle; margin-top: -1px"/>
  • Python{{ reldelim1 }}
  • - {%- if versionswitcher is defined %} + {%- if switchers is defined %} + {{ language or 'en' }} {{ release }} {% trans %}Documentation {% endtrans %}{{ reldelim1 }} {%- else %} @@ -41,7 +42,7 @@ {% if builder != "htmlhelp" %} {% if not embedded %}{% endif %} - {% if versionswitcher is defined and not embedded %}{% endif %} + {% if switchers is defined and not embedded %}{% endif %} {% if pagename == 'whatsnew/changelog' and not embedded %} {% endif %} - {% if versionswitcher is defined and not embedded %}{% endif %} + {% if switchers is defined and not embedded %}{% endif %} {% if pagename == 'whatsnew/changelog' and not embedded %} {% endif %} - {% if versionswitcher is defined and not embedded %}{% endif %} + {% if switchers is defined and not embedded %}{% endif %} {{ super() }} {% if builder == 'qthelp' %}