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

SyntaxWarning raised during import #75

Closed
tleonardi opened this issue Jan 20, 2020 · 2 comments
Closed

SyntaxWarning raised during import #75

tleonardi opened this issue Jan 20, 2020 · 2 comments
Labels

Comments

@tleonardi
Copy link
Contributor

Importing pubmed_parser in python3 raises the following warnings:

Python 3.8.1 (default, Jan  8 2020, 23:09:20) 
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pubmed_parser as p
/home/tleonardi/nobackup/pubmed_parse_tleonardi/pubmed_parser/pubmed_web_parser.py:147: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  pmc_text = [c for c in citation.split('/') if c is not ''][-1]
/home/tleonardi/nobackup/pubmed_parse_tleonardi/pubmed_parser/pubmed_web_parser.py:246: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if id_type is 'PMC':
/home/tleonardi/nobackup/pubmed_parse_tleonardi/pubmed_parser/pubmed_web_parser.py:249: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif id_type is 'PMID':
>>> 

This is due to a documented change in Python3.8.

The compiler now produces a SyntaxWarning when identity checks (is and is not)
are used with certain types of literals (e.g. strings, numbers). These can often work 
by accident in CPython, but are not guaranteed by the language spec. The warning
advises users to use equality tests (== and !=) instead. (Contributed by Serhiy
Storchaka in bpo-34850.)
@tleonardi tleonardi added the bug label Jan 20, 2020
tleonardi added a commit to tleonardi/pubmed_parser that referenced this issue Jan 20, 2020
@tleonardi tleonardi changed the title Bug report SyntaxWarning raised during import Jan 20, 2020
@titipata
Copy link
Owner

@tleonardi, ah, thanks for the catch! I will check through the repository to see if there are more errors similar to this issue before closing it.

@titipata
Copy link
Owner

titipata commented Feb 1, 2020

I checked this issue and it seems like this should be all fixed after #78. I will close this issue for now. Thanks @tleonardi for the contribution!

@titipata titipata closed this as completed Feb 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants