Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
98775dfe
Commit
98775dfe
authored
Sep 06, 2006
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #1550983: emit better error messages for erroneous relative
imports (if not in package and if beyond toplevel package).
parent
74bb783c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
Misc/NEWS
Misc/NEWS
+3
-0
Python/import.c
Python/import.c
+3
-2
No files found.
Misc/NEWS
View file @
98775dfe
...
...
@@ -12,6 +12,9 @@ What's New in Python 2.6 alpha 1?
Core and builtins
-----------------
- Bug #1550983: emit better error messages for erroneous relative
imports (if not in package and if beyond toplevel package).
- Overflow checking code in integer division ran afoul of new gcc
optimizations. Changed to be more standard-conforming.
...
...
Python/import.c
View file @
98775dfe
...
...
@@ -2114,7 +2114,7 @@ get_parent(PyObject *globals, char *buf, Py_ssize_t *p_buflen, int level)
size_t
len
;
if
(
lastdot
==
NULL
&&
level
>
0
)
{
PyErr_SetString
(
PyExc_ValueError
,
"Relative importpath too deep
"
);
"Attempted relative import in non-package
"
);
return
NULL
;
}
if
(
lastdot
==
NULL
)
...
...
@@ -2133,7 +2133,8 @@ get_parent(PyObject *globals, char *buf, Py_ssize_t *p_buflen, int level)
char
*
dot
=
strrchr
(
buf
,
'.'
);
if
(
dot
==
NULL
)
{
PyErr_SetString
(
PyExc_ValueError
,
"Relative importpath too deep"
);
"Attempted relative import beyond "
"toplevel package"
);
return
NULL
;
}
*
dot
=
'\0'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment