Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vm: implement IMPORT_NAME, IMPORT_FROM, IMPORT_STAR; py: factor Attri…
…bute code * Re-arrange and factor Attribute handling * Fix bug in import from curent directory * Implement IMPORT_*
- Loading branch information
Showing
10 changed files
with
147 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env python3.4 | ||
|
||
# test IMPORT_FROM | ||
|
||
from lib import libfn, libvar, libclass | ||
|
||
assert libfn() == 42 | ||
assert libvar == 43 | ||
assert libclass().method() == 44 | ||
|
||
# End with this | ||
finished = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env python3.4 | ||
|
||
# test IMPORT_NAME | ||
|
||
import lib | ||
|
||
assert lib.libfn() == 42 | ||
assert lib.libvar == 43 | ||
assert lib.libclass().method() == 44 | ||
|
||
# End with this | ||
finished = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env python3.4 | ||
|
||
# test IMPORT_STAR | ||
|
||
from lib import * | ||
|
||
assert libfn() == 42 | ||
assert libvar == 43 | ||
assert libclass().method() == 44 | ||
|
||
# FIXME - exception catching not working | ||
# ok = False | ||
# try: | ||
# _libprivate | ||
# except NameError: | ||
# ok = True | ||
# assert ok | ||
|
||
from lib1 import * | ||
|
||
assert lib1fn() == 42 | ||
assert lib1var == 43 | ||
|
||
# FIXME - exception handling broken | ||
# ok = False | ||
# try: | ||
# lib1class | ||
# except NameError: | ||
# ok = True | ||
# assert ok | ||
|
||
# FIXME - exception handling broken | ||
# ok = False | ||
# try: | ||
# _libprivate | ||
# except NameError: | ||
# ok = True | ||
# assert ok | ||
|
||
# End with this | ||
finished = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env python3.4 | ||
|
||
# Some targets to be imported | ||
|
||
def libfn(): | ||
return 42 | ||
|
||
libvar = 43 | ||
|
||
class libclass: | ||
def method(self): | ||
return 44 | ||
|
||
_libprivate = 45 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env python3.4 | ||
|
||
# Some targets to be imported | ||
|
||
__all__ = [ | ||
"lib1fn", | ||
"lib1var", | ||
] | ||
|
||
def lib1fn(): | ||
return 42 | ||
|
||
lib1var = 43 | ||
|
||
class lib1class: | ||
def method(self): | ||
return 44 | ||
|
||
_lib1private = 45 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters