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

parshios.getparsha_string(): Parsha variable is referenced before assignment. #1

Closed
mhornbacher opened this issue Sep 26, 2017 · 2 comments

Comments

@mhornbacher
Copy link
Contributor

mhornbacher commented Sep 26, 2017

Good morning,

I noticed an issue with the new update:

Steps to Reproduce:

  1. Install the latest version of the package.
  2. Load up a python console
    2.5. Import the library (from pyluach import dates, parshios, hebrewcal)
  3. Create a today variable (e.g. today = dates.HebrewDate.today() )
  4. Call the function e.g. parshios.getparsha_string(today)

Expected Behavior:

Returns a string of the parsha

Actual Behavior:

Throws the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/menachem/.local/lib/python3.5/site-packages/pyluach/parshios.py", line 137, in getparsha_string
    if parsha is None:
UnboundLocalError: local variable 'parsha' referenced before assignment

Proposed Solution:

Move line 139 above line 137 so that parsha is assigned before the check.

Notes

Already fixed in dev branch

Line location:

if parsha is None:

@mhornbacher mhornbacher changed the title parshios.getparsha_string: Parsha variable is referenced before assignment. parshios.getparsha_string(): Parsha variable is referenced before assignment. Sep 26, 2017
@mhornbacher mhornbacher changed the title parshios.getparsha_string(): Parsha variable is referenced before assignment. parshios.getparsha_string(): parsha variable is referenced before assignment. Sep 26, 2017
@mhornbacher mhornbacher changed the title parshios.getparsha_string(): parsha variable is referenced before assignment. parshios.getparsha_string(): Parsha variable is referenced before assignment. Sep 26, 2017
@simlist
Copy link
Owner

simlist commented Sep 27, 2017

Thank you for pointing that out. I forgot to merge that fix.

simlist added a commit that referenced this issue Sep 27, 2017
Test for issue #1.

Getparsha_string used variable before assignment.
@simlist simlist closed this as completed Sep 27, 2017
@mhornbacher
Copy link
Contributor Author

Your welcome. Chag Sameach!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants