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

UnboundLocalError: local variable 'end' referenced before assignment #17

Closed
pytestbot opened this issue Jan 9, 2011 · 3 comments
Closed
Labels
type: bug problem that needs to be addressed

Comments

@pytestbot
Copy link
Contributor

Originally reported by: BitBucket: blep, GitHub: blep


I'm not sure what is going on, but I started to get the error below. The full stack and tests are attached.

Environment: Python 3.2b2, Windows XPSP3, py.test 2.0

C:\Python32\lib\site-packages\py-1.4.0-py3.2.egg\py_code\source.py:142: in getstatementrange

  return start, end

E UnboundLocalError: local variable 'end' referenced before assignment


@pytestbot
Copy link
Contributor Author

Original comment by BitBucket: blep, GitHub: blep:


Hmm, the root of the problem is the inability to report the syntax error:

{{{
#!python

def new_method(cls, *args, *kwargs):
    new = dict.__new__(cls)
    dict.__init__(new, *args, *kwargs)
    raise ValueError( 'testtsts' )
    return new

}}}

=> missing * * on kwargs.

@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


fix issue17 by requiring an update to pylib which helps to fix it

@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


Actually to be clear: your example failed differently from yours but produced the same exception. i think i fixed at least one case and hope there is no other one. Your example is a bit confusing, to be honest because it contains code that is probably not neccessary. Can you try to install via e.g.

easy_install -i http://pypi.testrun.org -U pytest

and see if it actually fixes the problem for you? If not, please re-open and provide a more minimal example. Sidenote: it's better to not name your module exactly like a standard library one, in any case. Just use "mycollection" or so to disambiguate.
HTH,H.

@pytestbot pytestbot added the type: bug problem that needs to be addressed label Jun 15, 2015
fkohlgrueber pushed a commit to fkohlgrueber/pytest that referenced this issue Oct 27, 2018
blueyed added a commit that referenced this issue Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

1 participant