Skip to content
This repository was archived by the owner on Jan 23, 2024. It is now read-only.

Commit 96880f4

Browse files
xinghuadou-googleXinghua Dou
authored andcommitted
Fix some more unit tests under Python 3.
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=187681812
1 parent 6a10687 commit 96880f4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/googleclouddebugger/imphook2.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,13 @@ def GetCurrentPackage(globals):
249249
# names of real modules.
250250
for from_entry in fromlist or []:
251251
# Name relative to sys.path.
252-
names.add(name + '.' + from_entry)
252+
# For relative imports such as 'from . import x', name will be the empty
253+
# string. Thus we should not prepend a '.' to the entry.
254+
entry = (name + '.' + from_entry) if name else from_entry
255+
names.add(entry)
253256
# Name relative to the currently executing module's package.
254257
if curpkg:
255-
names.add(curpkg + '.' + name + '.' + from_entry)
258+
names.add(curpkg + '.' + entry)
256259

257260
# Generate all names from name. For instance, if name='a.b.c', then
258261
# we need to add ['a.b.c', 'a.b', 'a'].

0 commit comments

Comments
 (0)