Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-42634: Don't generate spurious line number in try-except-finally. #23760

Merged
merged 1 commit into from
Dec 14, 2020

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Dec 14, 2020

In 3.10a, the following function will generate a line event for line 4. This PR fixes that.

def func():
       try:
           2
       except:
           4
       finally:
           6

Skipping news as this is part of implementing PEP 626

https://bugs.python.org/issue42634

@markshannon markshannon merged commit 56aa20f into python:master Dec 14, 2020
@bedevere-bot
Copy link

@markshannon: Please replace # with GH- in the commit message next time. Thanks!

@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot s390x Fedora LTO + PGO 3.x has failed when building commit 56aa20f.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/545/builds/884) and take a look at the build logs.
  4. Check if the failure is related to this commit (56aa20f) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/545/builds/884

Summary of the results of the build (if available):

Click to see traceback logs
remote: Enumerating objects: 1        
remote: Enumerating objects: 9, done.        
remote: Counting objects:  11% (1/9)        
remote: Counting objects:  22% (2/9)        
remote: Counting objects:  33% (3/9)        
remote: Counting objects:  44% (4/9)        
remote: Counting objects:  55% (5/9)        
remote: Counting objects:  66% (6/9)        
remote: Counting objects:  77% (7/9)        
remote: Counting objects:  88% (8/9)        
remote: Counting objects: 100% (9/9)        
remote: Counting objects: 100% (9/9), done.        
remote: Compressing objects:  12% (1/8)        
remote: Compressing objects:  25% (2/8)        
remote: Compressing objects:  37% (3/8)        
remote: Compressing objects:  50% (4/8)        
remote: Compressing objects:  62% (5/8)        
remote: Compressing objects:  75% (6/8)        
remote: Compressing objects:  87% (7/8)        
remote: Compressing objects: 100% (8/8)        
remote: Compressing objects: 100% (8/8), done.        
remote: Total 9 (delta 1), reused 8 (delta 1), pack-reused 0        
From https://github.com/python/cpython
 * branch                  master     -> FETCH_HEAD
Reset branch 'master'

find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
make[2]: [Makefile:1837: clean-retain-profile] Error 1 (ignored)
In function ‘emit_pair’,
    inlined from ‘emit_delta’ at Objects/codeobject.c:423:14,
    inlined from ‘code_getlnotab’ at Objects/codeobject.c:462:18:
Objects/codeobject.c:414:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  414 |     *lnotab++ = b;
      |     ~~~~~~~~~~^~~
In function ‘emit_pair’,
    inlined from ‘emit_delta’ at Objects/codeobject.c:436:14,
    inlined from ‘code_getlnotab’ at Objects/codeobject.c:462:18:
Objects/codeobject.c:414:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  414 |     *lnotab++ = b;
      |     ~~~~~~~~~~^~~
In function ‘emit_pair’,
    inlined from ‘emit_delta’ at Objects/codeobject.c:429:14,
    inlined from ‘code_getlnotab’ at Objects/codeobject.c:462:18:
Objects/codeobject.c:414:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  414 |     *lnotab++ = b;
      |     ~~~~~~~~~~^~~
In function ‘assemble_emit_linetable_pair’,
    inlined from ‘assemble_line_range’ at Python/compile.c:5624:18:
Python/compile.c:5596:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 5596 |     *lnotab++ = ldelta;
      |     ~~~~~~~~~~^~~~~~~~
In function ‘assemble_emit_linetable_pair’,
    inlined from ‘assemble_line_range’ at Python/compile.c:5618:18:
Python/compile.c:5596:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 5596 |     *lnotab++ = ldelta;
      |     ~~~~~~~~~~^~~~~~~~
In function ‘assemble_emit_linetable_pair’,
    inlined from ‘assemble’ at Python/compile.c:6039:10:
Python/compile.c:5596:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 5596 |     *lnotab++ = ldelta;
      |     ~~~~~~~~~~^~~~~~~~
In function ‘emit_pair’,
    inlined from ‘emit_delta’ at Objects/codeobject.c:423:14,
    inlined from ‘code_getlnotab’ at Objects/codeobject.c:462:18:
Objects/codeobject.c:414:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  414 |     *lnotab++ = b;
      |               ^
In function ‘emit_pair’,
    inlined from ‘emit_delta’ at Objects/codeobject.c:436:14,
    inlined from ‘code_getlnotab’ at Objects/codeobject.c:462:18:
Objects/codeobject.c:414:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  414 |     *lnotab++ = b;
      |               ^
In function ‘emit_pair’,
    inlined from ‘emit_delta’ at Objects/codeobject.c:429:14,
    inlined from ‘code_getlnotab’ at Objects/codeobject.c:462:18:
Objects/codeobject.c:414:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  414 |     *lnotab++ = b;
      |               ^
In function ‘assemble_emit_linetable_pair’,
    inlined from ‘assemble_line_range’ at Python/compile.c:5624:18:
Python/compile.c:5596:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 5596 |     *lnotab++ = ldelta;
      |               ^
In function ‘assemble_emit_linetable_pair’,
    inlined from ‘assemble_line_range’ at Python/compile.c:5618:18:
Python/compile.c:5596:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 5596 |     *lnotab++ = ldelta;
      |               ^
In function ‘assemble_emit_linetable_pair’,
    inlined from ‘assemble’ at Python/compile.c:6039:10:
Python/compile.c:5596:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 5596 |     *lnotab++ = ldelta;
      |               ^
In function ‘emit_pair’,
    inlined from ‘emit_delta’ at Objects/codeobject.c:423:14,
    inlined from ‘code_getlnotab’ at Objects/codeobject.c:462:18:
Objects/codeobject.c:414:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  414 |     *lnotab++ = b;
      |               ^
In function ‘emit_pair’,
    inlined from ‘emit_delta’ at Objects/codeobject.c:436:14,
    inlined from ‘code_getlnotab’ at Objects/codeobject.c:462:18:
Objects/codeobject.c:414:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  414 |     *lnotab++ = b;
      |               ^
In function ‘emit_pair’,
    inlined from ‘emit_delta’ at Objects/codeobject.c:429:14,
    inlined from ‘code_getlnotab’ at Objects/codeobject.c:462:18:
Objects/codeobject.c:414:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  414 |     *lnotab++ = b;
      |               ^
In function ‘assemble_emit_linetable_pair’,
    inlined from ‘assemble_line_range’ at Python/compile.c:5624:18:
Python/compile.c:5596:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 5596 |     *lnotab++ = ldelta;
      |               ^
In function ‘assemble_emit_linetable_pair’,
    inlined from ‘assemble_line_range’ at Python/compile.c:5618:18:
Python/compile.c:5596:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 5596 |     *lnotab++ = ldelta;
      |               ^
In function ‘emit_pair’,
    inlined from ‘emit_delta’ at Objects/codeobject.c:423:14,
    inlined from ‘code_getlnotab’ at Objects/codeobject.c:462:18:
Objects/codeobject.c:414:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  414 |     *lnotab++ = b;
      |               ^
In function ‘emit_pair’,
    inlined from ‘emit_delta’ at Objects/codeobject.c:436:14,
    inlined from ‘code_getlnotab’ at Objects/codeobject.c:462:18:
Objects/codeobject.c:414:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  414 |     *lnotab++ = b;
      |               ^
In function ‘emit_pair’,
    inlined from ‘emit_delta’ at Objects/codeobject.c:429:14,
    inlined from ‘code_getlnotab’ at Objects/codeobject.c:462:18:
Objects/codeobject.c:414:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  414 |     *lnotab++ = b;
      |               ^
In function ‘assemble_emit_linetable_pair’,
    inlined from ‘assemble_line_range’ at Python/compile.c:5624:18:
Python/compile.c:5596:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 5596 |     *lnotab++ = ldelta;
      |               ^
In function ‘assemble_emit_linetable_pair’,
    inlined from ‘assemble_line_range’ at Python/compile.c:5618:18:
Python/compile.c:5596:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 5596 |     *lnotab++ = ldelta;
      |               ^
In function ‘assemble_emit_linetable_pair’,
    inlined from ‘assemble’ at Python/compile.c:6039:0:
Python/compile.c:5596:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 5596 |     *lnotab++ = ldelta;
      |               ^
In function ‘assemble_emit_linetable_pair’,
    inlined from ‘assemble’ at Python/compile.c:6039:0:
Python/compile.c:5596:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 5596 |     *lnotab++ = ldelta;
      |               ^
/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Modules/_pickle.c: In function ‘load_float’:
/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Modules/_pickle.c:5390:9: warning: ‘s’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 5390 |     d = PyOS_string_to_double(s, &endptr, PyExc_OverflowError);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Modules/_pickle.c: In function ‘load_string’:
/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Modules/_pickle.c:5439:30: warning: ‘s’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 5439 |     if (len >= 2 && s[0] == s[len - 1] && (s[0] == '\'' || s[0] == '"')) {
      |                              ^
/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Modules/_pickle.c: In function ‘load_int’:
/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Modules/_pickle.c:5176:17: warning: ‘s’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 5176 |         value = PyLong_FromString(s, NULL, 0);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Modules/socketmodule.c: In function ‘getsockaddrarg’:
/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Modules/socketmodule.c:2353:9: warning: ‘strncpy’ specified bound 64 equals destination size [-Wstringop-truncation]
 2353 |         strncpy((char *)sa->salg_name, name, sizeof(sa->salg_name));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘assemble_emit_linetable_pair’,
    inlined from ‘assemble’ at Python/compile.c:6039:10:
Python/compile.c:5596:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 5596 |     *lnotab++ = ldelta;
      |     ~~~~~~~~~~^~~~~~~~
Python/frozenmain.c: In function ‘Py_FrozenMain’:
Python/frozenmain.c:129:1: warning: ‘/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Python/frozenmain.gcda’ profile count data file not found [-Wmissing-profile]
  129 | }
      | ^
Python/pyfpe.c: In function ‘PyFPE_dummy’:
Python/pyfpe.c:15:1: warning: ‘/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Python/pyfpe.gcda’ profile count data file not found [-Wmissing-profile]
   15 | }
      | ^
In function ‘assemble_emit_linetable_pair’,
    inlined from ‘assemble’ at Python/compile.c:6039:10:
Python/compile.c:5596:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 5596 |     *lnotab++ = ldelta;
      |               ^
/usr/bin/ld: python.lto.o: in function `run_mod':
/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Python/pythonrun.c:1230: undefined reference to `PyAST_CompileObject'
/usr/bin/ld: python.lto.o: in function `builtin_compile':
/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Python/bltinmodule.c:808: undefined reference to `PyAST_CompileObject'
/usr/bin/ld: python.lto.o: in function `Py_CompileStringObject':
/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Python/pythonrun.c:1307: undefined reference to `PyAST_CompileObject'
/usr/bin/ld: python.lto.o: in function `symtable_lookup':
/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Python/symtable.c:1004: undefined reference to `_Py_Mangle'
/usr/bin/ld: python.lto.o: in function `symtable_record_directive':
/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Python/symtable.c:1161: undefined reference to `_Py_Mangle'
/usr/bin/ld: python.lto.o: in function `type_new':
/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Objects/typeobject.c:2544: undefined reference to `_Py_Mangle'
/usr/bin/ld: python.lto.o: in function `symtable_add_def_helper':
/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Python/symtable.c:1018: undefined reference to `_Py_Mangle'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:592: python] Error 1
make[1]: *** Waiting for unfinished jobs....
/usr/bin/ld: _testembed.lto.o: in function `run_mod':
/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Python/pythonrun.c:1230: undefined reference to `PyAST_CompileObject'
/usr/bin/ld: _testembed.lto.o: in function `builtin_compile':
/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Python/bltinmodule.c:808: undefined reference to `PyAST_CompileObject'
/usr/bin/ld: _testembed.lto.o: in function `Py_CompileStringObject':
/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Python/pythonrun.c:1307: undefined reference to `PyAST_CompileObject'
/usr/bin/ld: _testembed.lto.o: in function `symtable_lookup':
/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Python/symtable.c:1004: undefined reference to `_Py_Mangle'
/usr/bin/ld: _testembed.lto.o: in function `symtable_record_directive':
/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Python/symtable.c:1161: undefined reference to `_Py_Mangle'
/usr/bin/ld: _testembed.lto.o: in function `type_new':
/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Objects/typeobject.c:2544: undefined reference to `_Py_Mangle'
/usr/bin/ld: _testembed.lto.o: in function `symtable_add_def_helper':
/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.lto-pgo/build/Python/symtable.c:1018: undefined reference to `_Py_Mangle'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:727: Programs/_testembed] Error 1
make: *** [Makefile:536: profile-opt] Error 2

adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants