This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: parsermodule won't validate relative imports
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.0, Python 2.6, Python 2.5
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, david_k_hess, dbinger
Priority: normal Keywords: patch

Created on 2008-10-05 22:15 by dbinger, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
parserdot.diff dbinger, 2008-10-05 22:15 Patch to parsermodule.c and
Messages (3)
msg74354 - (view) Author: David Binger (dbinger) Date: 2008-10-05 22:15
The parser module validates st instances that it builds from 
list or tuple structures.  This validation fails for parse
trees that include relative imports because it fails to correctly
count the dots that immediately follow the "from" token.

Here is a test and a patch.

This bug probably extends back to all Python 2 versions that support
relative import, but I have not checked it.

Fixing this has immediate value to me because the QPY package 
depends on the parser module to convert list structures into st 
instances.  (In the long run, I wonder if the verification
part of the sequence2st() function could be made optional or dropped,
since the current pattern requires to parser module to be updated
every time the language grammer changes.)
msg74356 - (view) Author: David Hess (david_k_hess) Date: 2008-10-06 00:04
Confirmed the presence of this same problem in the source code of 
parsermodule.c in branches release25-maint and release26-maint.
msg75465 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-11-03 15:15
Thanks for the patch! Fixed in r67077.
Date User Action Args
2022-04-11 14:56:40adminsetgithub: 48298
2008-11-03 15:15:06benjamin.petersonsetstatus: open -> closed
resolution: fixed
messages: + msg75465
nosy: + benjamin.peterson
2008-10-06 00:04:37david_k_hesssetnosy: + david_k_hess
messages: + msg74356
versions: + Python 2.6, Python 2.5
2008-10-05 22:15:19dbingercreate