[issue4489] shutil.rmtree is vulnerable to a symlink attack

2012-06-23 Thread Nick Coghlan
Nick Coghlan added the comment: I'm in the process of updating the LBYL support to use a "rmtree.avoids_symlink_attacks" function attribute rather than the "rmtree_is_safe" module level attribute. As I said in the hmac.secure_compare function discussion, the words

[issue4489] shutil.rmtree is vulnerable to a symlink attack

2012-06-23 Thread Nick Coghlan
Nick Coghlan added the comment: Éric - there's almost certainly going to be a PEP for 3.4 about doing this kind of feature advertisement in a cleaner and more consistent way. -- ___ Python tracker <http://bugs.python.org/i

[issue15003] make PyNamespace_New() public

2012-06-24 Thread Nick Coghlan
Nick Coghlan added the comment: -1. The entire Python API is already accessible from C, so expansions to the public C API need more justification than "it's exposed in Python". If new instances of this type end up being used in performance critical third party C extensions, t

[issue11260] smtpd-as-a-script feature should be documented and should use argparse

2012-05-28 Thread Nick Coghlan
Nick Coghlan added the comment: I created #14945 as a suggestion to add a simple page to http://docs.python.org/dev/using/index.html that will provide a central reference to the module documentation for modules with officially supported behaviour when used with the "-m&qu

[issue14945] Setup & Usage documentation for selected stdlib modules

2012-05-28 Thread Nick Coghlan
Nick Coghlan added the comment: Found it: #11260. I've left it open, since the original suggestion in that issue is related to actually documenting the -m behaviour of the smptd module - it was just the issue *discussion* that ended up covering the more general question of how such co

[issue14944] Setup & Usage documentation for pydoc, idle & 2to3

2012-05-28 Thread Nick Coghlan
Nick Coghlan added the comment: Same goes for idle and 2to3. These may just be cross-references to the relevant module documentation rather than completely new text. -- title: Setup & Usage documentation for pydoc -> Setup & Usage documentation for pydoc,

[issue14945] Setup & Usage documentation for selected stdlib modules

2012-05-28 Thread Nick Coghlan
Nick Coghlan added the comment: Additional candidates after grepping the docs: python -m site python -m sysconfig python -m pickle python -m pickletools python -m compileall python -m test -- ___ Python tracker <http://bugs.python.org/issue14

[issue14942] add PyType_New()

2012-05-28 Thread Nick Coghlan
Nick Coghlan added the comment: I realised that with the addition of types.new_class(), that's fairly easy to invoke from C (no harder than any other Python function, anyway). Thus, no need to duplicate the functionality directly in the C API. -- resolution: -> rejected stat

[issue14657] Avoid two importlib copies

2012-06-24 Thread Nick Coghlan
Nick Coghlan added the comment: Given Antoine's other change to the build process to fix the bootstrapping problem, I'm OK with leaving it up to anyone hacking on _bootstrap.py to remember that they need to run make if they want the interpreter to see any of their changes. Un

[issue4489] shutil.rmtree is vulnerable to a symlink attack

2012-06-24 Thread Nick Coghlan
Nick Coghlan added the comment: Tinkering with os.path.join, that traceback means that "name" is a str instance, while "path" is a bytes instance. The culprit actually appears to be the fact that the type returned by os.listdir (et al) when handed a file descriptor is a

[issue15176] Clarify the behavior of listdir(fd) in both code and documentation

2012-06-24 Thread Nick Coghlan
Nick Coghlan added the comment: +1 for changing the API for any cases where the filesystem path is also used to determine the return type - given that we stuffed this up for the rmtree implementation, I expect end users would be prone to making exactly the same mistake. Retaining the

[issue15176] Clarify the behavior of listdir(fd) in both code and documentation

2012-06-24 Thread Nick Coghlan
Nick Coghlan added the comment: Don't forget to point people to os.fsencode() if they actually wanted bytes, or os.fsdecode() if they already have bytes and want to convert them to text. -- ___ Python tracker <http://bugs.python.org/is

[issue15180] Cryptic traceback from os.path.join when mixing str & bytes

2012-06-25 Thread Nick Coghlan
New submission from Nick Coghlan : As seen in #4489, the traceback when mixing str and bytes in os.path.join is rather cryptic and hard to decipher if you've never encountered it before: >>> import os.path >>> os.path.join(b'', '') Traceback (mo

[issue15180] Cryptic traceback from os.path.join when mixing str & bytes

2012-06-25 Thread Nick Coghlan
Nick Coghlan added the comment: Yeah, that should do it - I just hadn't looked at the structure of the code to see how annoying it will be to separate the check out from the if statement. Good use case for PEP 409, too :) -- ___ Python tr

[issue15185] Validate callbacks in 'contextlib.ExitStack.callback()'

2012-06-25 Thread Nick Coghlan
Nick Coghlan added the comment: I'm not comfortable adding a dependency on inspect to the contextlib module, and I think it would be undesirable to have too many cases where the early validation is silently skipped. While I like the idea of adding early signature validation to these AP

[issue5441] Convenience API for timeit.main

2012-06-26 Thread Nick Coghlan
Nick Coghlan added the comment: Close in favour of #6422 - that one at least has a patch :) -- resolution: -> duplicate superseder: -> timeit called from within Python should allow autoranging ___ Python tracker <http://bugs.python.org/

[issue6422] timeit called from within Python should allow autoranging

2012-06-26 Thread Nick Coghlan
Nick Coghlan added the comment: In #5442, I proposed leaving the architecture of the module alone, and simply exposing the main module functionality as a high level helper function: def measure(stmt="pass", setup="pass", timer=default_timer, repeat=de

[issue6422] timeit called from within Python should allow autoranging

2012-06-26 Thread Nick Coghlan
Nick Coghlan added the comment: Oops, that link reference should have been to #5441. -- ___ Python tracker <http://bugs.python.org/issue6422> ___ ___ Python-bug

[issue6422] timeit called from within Python should allow autoranging

2012-06-26 Thread Nick Coghlan
Changes by Nick Coghlan : -- resolution: accepted -> ___ Python tracker <http://bugs.python.org/issue6422> ___ ___ Python-bugs-list mailing list Unsubscri

[issue5441] Convenience API for timeit.main

2012-06-26 Thread Nick Coghlan
Changes by Nick Coghlan : -- status: open -> closed ___ Python tracker <http://bugs.python.org/issue5441> ___ ___ Python-bugs-list mailing list Unsubscri

[issue15209] Re-raising exceptions from an expression

2012-06-27 Thread Nick Coghlan
Nick Coghlan added the comment: The from clause is intended for replacing previous exceptions with *new* exceptions, not editing the attributes of existing ones which may already have a different __cause__ set. So - 1 from me, even for 3.4. A patch to the docs explaining that this is not

[issue15209] Re-raising exceptions from an expression

2012-06-27 Thread Nick Coghlan
Nick Coghlan added the comment: The purpose of the from clause in general is to change the exception *type* (for example, from KeyError -> AttributeError or vice-versa), or to add additional information without losing access to any previous information (like the original traceback). This

[issue15203] Accepting of os functions of (path, dir_fd) pair as argument

2012-06-28 Thread Nick Coghlan
Nick Coghlan added the comment: Correctly avoiding symlink attacks, which is the whole reason the POSIX *at variants and the dir_fd parameters were added, is not trivial in general. os.fwalk and shutil.rmtree went through many iterations before reaching a state where they should successfully

[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2012-06-28 Thread Nick Coghlan
Nick Coghlan added the comment: My current opinion is that this should be a PEP for 3.4, to make sure we flush out all the corner cases and other details correctly. -- versions: +Python 3.4 -Python 3.3 ___ Python tracker <http://bugs.python.

[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2012-06-28 Thread Nick Coghlan
Nick Coghlan added the comment: For that matter, with the relevant codecs restored in 3.2, a transform() helper could probably be added to six (or a new project on PyPI) to prototype the approach. -- ___ Python tracker <http://bugs.python.

[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2012-06-28 Thread Nick Coghlan
Nick Coghlan added the comment: Setting as a release blocker for 3.4 - this is important. -- priority: normal -> release blocker stage: commit review -> ___ Python tracker <http://bugs.python.org/

[issue15216] Support setting the encoding on a text stream after creation

2012-06-28 Thread Nick Coghlan
New submission from Nick Coghlan : As discussed on python-ideas, swapping out the sys.std* streams can be fraught with peril. This can make writing code that wants to support an "--encoding" option for pipeline processing difficult. The proposal [1] is that TextIOWrapper

[issue14133] improved PEP 409 implementation

2012-06-28 Thread Nick Coghlan
Nick Coghlan added the comment: Yep - note that PEP 409 was updated to say that the the implementation discussion has been superceded by PEP 415. It may be worth making that note more prominent, though... -- ___ Python tracker <h

[issue15209] Re-raising exceptions from an expression

2012-06-28 Thread Nick Coghlan
Nick Coghlan added the comment: If you don't want the exception context set *at all*, just use a pass statement to get out of the exception before trying the fallback. try: return windows_module.getch() except NameError: pass # No exception cha

[issue15209] Re-raising exceptions from an expression

2012-06-28 Thread Nick Coghlan
Nick Coghlan added the comment: Correction, your try block is overbroad and will suppress errors in the getch implementation. This is better: try: _getch = windows_module.getch except NameError: _ getch = fallback_module.getch _getch() So I'm sticking wi

[issue15221] os.path.is*() may return False if path can't be accessed

2012-06-28 Thread Nick Coghlan
Nick Coghlan added the comment: The os.path.exists() docs already cover all the gory details of when it may be false due to limited permissions. The is* docs refer to this by their use of the word "existing", but that's probably too subtle. I suggest adding an extra sentence

[issue15216] Support setting the encoding on a text stream after creation

2012-06-30 Thread Nick Coghlan
Nick Coghlan added the comment: Indeed. However, the current alternatives (based on detach() and fileNo()) are also problematic - using detach() breaks the corresponding sys.__std*__ entry, while using fileNo() means you now have two independent IO stacks using the same underlying descriptor

[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2012-07-01 Thread Nick Coghlan
Nick Coghlan added the comment: Alternatively, perhaps it would make sense to have a "reopen()" method on file objects that covers the necessary dance to reopen with the correct flags? That would solve more problems than just this one (possibly including making it possible

[issue12535] Chained tracebacks are confusing because the first traceback is minimal

2012-07-04 Thread Nick Coghlan
Nick Coghlan added the comment: I've thought of a different approach to this which should be less hazardous to doctests: include the truncation warning in the *traceback* section, rather than in the header. doctests already ignore the details of that section because checking it i

[issue14814] Implement PEP 3144 (the ipaddress module)

2012-07-06 Thread Nick Coghlan
Nick Coghlan added the comment: Just letting people know I'm working on a patch that updates the class constructors to give meaningful error messages for malformed addresses, instead of assuming that users can figure it out just by looking at the address. I'm also updating the tes

[issue14814] Implement PEP 3144 (the ipaddress module)

2012-07-07 Thread Nick Coghlan
Nick Coghlan added the comment: There's actually one semantic change in that last patch: IPv4Address (et al) will now accept leading zeroes in those cases where they're *not* ambiguous (i.e. values less than 8, which have identical representations in both decimal and octa

[issue14814] Implement PEP 3144 (the ipaddress module)

2012-07-07 Thread Nick Coghlan
Nick Coghlan added the comment: Also, I noted the provisional API status in the NEWS message, but I wonder if it would make more sense to leave that kind of note for the commit messages. -- ___ Python tracker <http://bugs.python.org/issue14

[issue15272] pkgutil.find_loader accepts invalid module names

2012-07-07 Thread Nick Coghlan
New submission from Nick Coghlan : The pkgutil import emulation is insane and permits modules identifiers to contain paths. Identified in #15230 (reporting some very surprising behaviour from runpy.run_module). -- messages: 164806 nosy: brett.cannon, ncoghlan priority: normal

[issue14879] invalid docs for subprocess exceptions with shell=True

2012-07-07 Thread Nick Coghlan
Nick Coghlan added the comment: I would add a simple note to the exceptions section: "Note, when "shell=True", OSError will be raised by the child only if the selected shell itself cannot be found. To determine if the shell failed to find the requested application, it is nec

[issue15230] runpy.run_path doesn't set __package__ correctly

2012-07-07 Thread Nick Coghlan
Nick Coghlan added the comment: Firstly, I think you've identified a real bug with __package__ not being set correctly when using runpy.run_path (and I have updated this issue title accordingly). I have also created a separate bug report (#15272) for the bizarre behaviour you identifi

[issue15230] runpy.run_path doesn't set __package__ correctly

2012-07-07 Thread Nick Coghlan
Changes by Nick Coghlan : -- assignee: -> ncoghlan ___ Python tracker <http://bugs.python.org/issue15230> ___ ___ Python-bugs-list mailing list Unsubscri

[issue15230] runpy.run_path doesn't set __package__ correctly

2012-07-07 Thread Nick Coghlan
Nick Coghlan added the comment: You may also have identified a bug with pkgutil's import emulation failing to clean up sys.modules correctly when an import fails. -- ___ Python tracker <http://bugs.python.org/is

[issue15230] runpy.run_path doesn't set __package__ correctly

2012-07-07 Thread Nick Coghlan
Nick Coghlan added the comment: Sorry, that's not accurate - you have enough code in b.py to make the relative import work by convincing the interpreter it's actually being done in a package. So what you're seeing in that regard is the fact that runpy is not any kind of sand

[issue14814] Implement PEP 3144 (the ipaddress module)

2012-07-07 Thread Nick Coghlan
Nick Coghlan added the comment: Many of Serhiy's tweaks were also micro-optimisations, but I committed them mainly because I found them easier to read. -- ___ Python tracker <http://bugs.python.org/is

[issue14814] Implement PEP 3144 (the ipaddress module)

2012-07-07 Thread Nick Coghlan
Nick Coghlan added the comment: My guess would be that they're intended as a micro-optimisation (instance lookups should be faster than class attribute lookups). You do lose on the memory front though, since they make the instances bigger. Without a micro benchmark of any kind, I&

[issue14814] Implement PEP 3144 (the ipaddress module)

2012-07-07 Thread Nick Coghlan
Nick Coghlan added the comment: FWIW, if we *were* going to micro-optimise ipaddress, one of the first places I'd start is using __slots__ to try to bring the instance size down (since any application using the module is likely to end up creating a *lot* of these objects). There are

[issue14814] Implement PEP 3144 (the ipaddress module)

2012-07-07 Thread Nick Coghlan
Nick Coghlan added the comment: Yup, it's broken (doesn't handle NotImplemented correctly) and Raymond isn't keen on fixing it. I should add a link to the relevant tracker issue in a comment, though. -- ___ Python tracker <http

[issue7897] Support parametrized tests in unittest

2012-07-07 Thread Nick Coghlan
Nick Coghlan added the comment: As another in-the-standard-library uses case: my additions to the ipaddress test suite are really crying out for parameterised test support. My current solution is adequate for coverage and debugging purposes (a custom assert applied to multiple values in a

[issue10042] functools.total_ordering fails to handle NotImplemented correctly

2012-07-08 Thread Nick Coghlan
Changes by Nick Coghlan : -- title: total_ordering -> functools.total_ordering fails to handle NotImplemented correctly ___ Python tracker <http://bugs.python.org/issu

[issue15292] import hook behavior documentation improvement

2012-07-08 Thread Nick Coghlan
Nick Coghlan added the comment: The PyPy and 3.3 behaviour are actually correct according to the spec, but it's *really* unclear in PEP 302. sys.meta_path accepts finder objects. These are explicitly documented as returning "None" from find_module() to indicate "try the n

[issue15292] import hook behavior documentation improvement

2012-07-08 Thread Nick Coghlan
Nick Coghlan added the comment: Perhaps the porting section in the 3.3 What's New? -- ___ Python tracker <http://bugs.python.org/issue15292> ___ ___ Pytho

[issue15314] Use importlib instead of pkgutil in runpy

2012-07-09 Thread Nick Coghlan
New submission from Nick Coghlan : There's some lingering weirdness in runpy due to its reliance on pkgutil's import emulation (see #15272). For 3.3, I'd like to explicitly switch runpy over to using importlib. This was supposed to happen automatically, but the

[issue15272] pkgutil.find_loader accepts invalid module names

2012-07-09 Thread Nick Coghlan
Nick Coghlan added the comment: I've taken 3.2 and 2.7 off the list - no doubt someone, somewhere is relying on this particular piece of missing input validation, so it's not worth risking breakage in a point release. I think it's worth fixing for 3.3, though. -- nosy

[issue15331] Missing codec aliases for bytes-bytes codecs

2012-07-12 Thread Nick Coghlan
New submission from Nick Coghlan : In writing a post looking at a potentially different way of handling codec pipelines that is source compatible across both Python 2 and 3, I noticed that the bytes-bytes codec aliases are all missing but are still listed in the documentation as being

[issue15331] Codecs docs should explain that the bytes-bytes shorthand aliases are missing

2012-07-14 Thread Nick Coghlan
Nick Coghlan added the comment: While you're right about that, the docs shouldn't be claiming they're available as long as that is the case. Updated the issue to make it clear this is a problem with the current docs and the change in the nature of the encode() and decode() met

[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2012-07-14 Thread Nick Coghlan
Nick Coghlan added the comment: FWIW it's, I've been thinking further about this recently and I think implementing this feature as builtin methods is the wrong way to approach it. Instead, I propose the addition of codecs.encode and codecs.decode methods that are type neutral (l

[issue15339] document the threading "facts of life" in Python

2012-07-14 Thread Nick Coghlan
Nick Coghlan added the comment: Given the scope of the issue, a concurrent programming howto that lists some of the available options and the caveats associated with each of them seems worthwhile. -- nosy: +ncoghlan ___ Python tracker <h

[issue15343] "pydoc -w " writes out page with empty "Package Contents" section

2012-07-14 Thread Nick Coghlan
Nick Coghlan added the comment: Indeed, pydoc relies on pkgutil.walk_packages to work out what to document, and that's broken currently due to the reliance on a non-standard importer API that isn't in PEP 302 (not even as an optional extension, like the get_filename() used by runpy

[issue15343] "pydoc -w " writes out page with empty "Package Contents" section

2012-07-14 Thread Nick Coghlan
Nick Coghlan added the comment: *sigh* And, of course, there's no meaningful regression test defined for pkgutil.walk_packages, which is why the test suite didn't pick this up :( Oh well, at least I have a clear place to start. -- assignee: -

[issue15357] Deprecate redundant pieces of pkgutil

2012-07-14 Thread Nick Coghlan
New submission from Nick Coghlan : To set the stage for fixing the regression reported in #15343, I'm going through and clearly marking the parts of pkgutil which should no longer be used now that the default import system is PEP 302 compliant. -- assignee: ncoghlan compo

[issue14814] Implement PEP 3144 (the ipaddress module)

2012-07-14 Thread Nick Coghlan
Nick Coghlan added the comment: Unassigning for the moment - I'm busy fighting fires in pkgutil (which is actually broken due to the import changes). If someone else has time to flesh out the method and data attribute documentation for the ipaddress classes, that would be

[issue15299] pkgutil.ImpImporter(None).iter_modules() does not search sys.path

2012-07-14 Thread Nick Coghlan
Nick Coghlan added the comment: The pkgutil import emulation is being deprecated in 3.3 However, I'll use this as useful input for any new walk_packages tests added while resolving #15343 -- resolution: -> wont fix stage: needs patch -> committed/rejected status: ope

[issue15272] pkgutil.find_loader accepts invalid module names

2012-07-14 Thread Nick Coghlan
Nick Coghlan added the comment: I'll add a regression test for this as part of my purge of any internal usage of the pkgutil import emulation. -- ___ Python tracker <http://bugs.python.org/is

[issue15314] Use importlib instead of pkgutil in runpy

2012-07-14 Thread Nick Coghlan
Nick Coghlan added the comment: OK, the way I plan to tackle this is to actually redirect the pkgutil APIs to importlib (rather than using the private import emulation). The reason I'm going to tackle it like this is that there are some assumptions pkgutil deals with that importlib do

[issue15314] Use importlib instead of pkgutil in runpy

2012-07-14 Thread Nick Coghlan
Nick Coghlan added the comment: Oh, special - importlib.find_loader() currently expects every module to have a __loader__ attribute, but there's at least one that doesn't: __main__. Guess I'll be tweaking it to handle that case more grace

[issue15314] Use importlib instead of pkgutil in runpy

2012-07-14 Thread Nick Coghlan
Nick Coghlan added the comment: Ah, __main__, thou art such a special beast. Here's my current plan: 1. __main__ will be initialised with __loader__ set to BuiltinImporter. This covers cases like the interactive prompt or execution of stdin where there is no source code availabl

[issue15314] Use importlib instead of pkgutil in runpy

2012-07-15 Thread Nick Coghlan
Nick Coghlan added the comment: OK, I think runpy and __main__.__loader__ are all sorted now. The relevant runpy and command line script tests all check for the expected values, and I added a couple of new tests to cover the "-c" and "reading from stdin" cases. -

[issue15272] pkgutil.find_loader accepts invalid module names

2012-07-15 Thread Nick Coghlan
Changes by Nick Coghlan : -- assignee: -> ncoghlan ___ Python tracker <http://bugs.python.org/issue15272> ___ ___ Python-bugs-list mailing list Unsubscri

[issue15272] pkgutil.find_loader accepts invalid module names

2012-07-15 Thread Nick Coghlan
Nick Coghlan added the comment: OK, this one is trickier than I thought - the exact behaviour depends on how you traverse the code, and I believe a PEP 302 importer is technically allowed to accept "/" in module names. (Unless there's a module names "must be valid i

[issue15358] Test pkgutil.walk_packages in test_pkgutil instead of test_runpy

2012-07-15 Thread Nick Coghlan
New submission from Nick Coghlan : Created to record the egregious hack of relying on the test_runpy infrastructure in order to test pkgutil.walk_packages. It gets the job done, but is a really messy way of going about it. Worth cleaning up by factoring the support code out to a helper module

[issue15358] Test pkgutil.walk_packages in test_pkgutil instead of test_runpy

2012-07-15 Thread Nick Coghlan
Changes by Nick Coghlan : -- dependencies: +"pydoc -w " writes out page with empty "Package Contents" section ___ Python tracker <http://bug

[issue15358] Test pkgutil.walk_packages in test_pkgutil instead of test_runpy

2012-07-15 Thread Nick Coghlan
Nick Coghlan added the comment: Also, a second test case should be added to cover the zipimporter.zipimporter component. -- ___ Python tracker <http://bugs.python.org/issue15

[issue15358] Test pkgutil.walk_packages in test_pkgutil instead of test_runpy

2012-07-15 Thread Nick Coghlan
Changes by Nick Coghlan : -- priority: low -> normal ___ Python tracker <http://bugs.python.org/issue15358> ___ ___ Python-bugs-list mailing list Unsubscri

[issue15343] "pydoc -w " writes out page with empty "Package Contents" section

2012-07-15 Thread Nick Coghlan
Nick Coghlan added the comment: Fixing this has uncovered another issue: the old import emulation in PEP 302 ignored encoding cookies, thus merrily decoding everything as utf-8 in "get_source()". importlib is smarter about this, which means the pydoc tests started failing as the

[issue15343] "pydoc -w " writes out page with empty "Package Contents" section

2012-07-15 Thread Nick Coghlan
Nick Coghlan added the comment: Main change in that last commit is really the one to make pydoc ignore just about *any* exception from get_source(). This should make it more robust against buggy loaders, too. -- ___ Python tracker <h

[issue15343] "pydoc -w " writes out page with empty "Package Contents" section

2012-07-15 Thread Nick Coghlan
Nick Coghlan added the comment: And a manual check confirms the higher level issue is also fixed. (I believe there's already a meta issue somewhere about the lack of automated tests for pydoc's emitted HTML) -- resolution: -> fixed status: o

[issue15357] Deprecate redundant pieces of pkgutil

2012-07-15 Thread Nick Coghlan
Nick Coghlan added the comment: I'm pretty sure I got them all while fixing #15343 -- resolution: -> fixed stage: -> committed/rejected status: open -> closed ___ Python tracker <http://bugs.pyth

[issue14787] pkgutil.walk_packages returns extra modules

2012-07-16 Thread Nick Coghlan
Nick Coghlan added the comment: Right, this is a separate bug in pkgutil. Specifically, when it goes to import a package in order to check it for submodules, it invokes the global import system via __import__() rather than constraining the import to the path argument supplied to

[issue14787] pkgutil.walk_packages returns extra modules

2012-07-16 Thread Nick Coghlan
Nick Coghlan added the comment: At the very least, the pkgutil docs need to state clearly that walk_packages only works properly with sys.path entries, and the constraint feature may not descend into packages correctly if an entry is shadowed by a sys.modules entry or an entry earlier on

[issue15370] test_runpy should include namespace package tests

2012-07-16 Thread Nick Coghlan
New submission from Nick Coghlan : test_runpy doesn't currently check that code can be correctly executed from namespace packages -- components: Tests messages: 165613 nosy: ncoghlan priority: normal severity: normal status: open title: test_runpy should include namespace package

[issue15371] test_cmd_line_script should include namespace package tests

2012-07-16 Thread Nick Coghlan
New submission from Nick Coghlan : test_cmd_line_script doesn't currently check that namespace packages and submodules of namespace packages can be executed via the -m switch -- components: Library (Lib) messages: 165614 nosy: ncoghlan priority: normal severity: normal status:

[issue15358] Test pkgutil.walk_packages in test_pkgutil instead of test_runpy

2012-07-16 Thread Nick Coghlan
Nick Coghlan added the comment: The walk_packages tests should also be enhanced to ensure correctly handling of namespace packages -- ___ Python tracker <http://bugs.python.org/issue15

[issue15358] Test pkgutil.walk_packages in test_pkgutil instead of test_runpy

2012-07-16 Thread Nick Coghlan
Nick Coghlan added the comment: Note that the problem described in #14787 will limit the scope of what can be tested. -- ___ Python tracker <http://bugs.python.org/issue15

[issue14787] pkgutil.walk_packages returns extra modules

2012-07-16 Thread Nick Coghlan
Nick Coghlan added the comment: I just realised this is going to behave strangely with namespace packages as well: the __import__ step will pick up *every* portion of the namespace package, not just those defined in the identified subset of sys.path

[issue15368] bytecode generation is not deterministic

2012-07-16 Thread Nick Coghlan
Nick Coghlan added the comment: At least we know the hash randomisation is working :) Spurious changes when freezing modules seems like a legitimate reason to fix it - the import benchmarks would probably give the compiler enough of a workout to highlight if the sorting is excessively time

[issue15358] Test pkgutil.walk_packages in test_pkgutil instead of test_runpy

2012-07-17 Thread Nick Coghlan
Nick Coghlan added the comment: That sounds good, and thanks for working on this - if we can get the tests cleaned up for the 3.3 release, that will make ongoing maintenance a lot easier. -- ___ Python tracker <http://bugs.python.org/issue15

[issue15377] os.path.join() error misleading with path1=None

2012-07-17 Thread Nick Coghlan
Nick Coghlan added the comment: I'd be more inclined to tighten up the check for the "can't mix" message to something like: valid_types = all(isinstance(s, (str, bytes, bytearray)) for s in (a, ) + p) if valid_types: # Must have a mixture of text and binary data

[issue15230] runpy.run_path doesn't set __package__ correctly

2012-07-17 Thread Nick Coghlan
Nick Coghlan added the comment: *grumble*grumble*os-x-and-its-crazy-symlink-as-tmp-dir*grumble*grumble* I'm fairly sure I've tripped over this kind of thing before, so I believe I know how to fix it (add a realpath() call when figuring out the expected path value). The buildbots w

[issue15376] Refactor the create-package code in test_runpy into a helper module

2012-07-17 Thread Nick Coghlan
Nick Coghlan added the comment: One trap to watch out for: it's best to call os.path.realpath() on any temporary directories created, since the interpreter tends to do that internally. I'd previously dealt with this in script_helper.temp_dir, but it came up again when I tighte

[issue15377] os.path.join() error misleading with path1=None

2012-07-17 Thread Nick Coghlan
Nick Coghlan added the comment: Looks good to me -- ___ Python tracker <http://bugs.python.org/issue15377> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue15230] runpy.run_path doesn't set __package__ correctly

2012-07-17 Thread Nick Coghlan
Nick Coghlan added the comment: Closing again, since the OS X buildbot was happy with the change on 3.2. If trunk fails (which it shouldn't), that should be filed as a new issue (as it would almost certainly relate to the move from the pkgutil emulation to importlib). -- s

[issue15314] Use importlib instead of pkgutil in runpy

2012-07-17 Thread Nick Coghlan
Nick Coghlan added the comment: OK, I just pushed a tweak to the test that will hopefully resolve the problem. If the tweak works, though, it does suggest we have a bit of weirdness in importlib: it means pkgutil.get_importer("") is returning an importer on POSIX systems, but None

[issue15384] FileFinder.path_hook()("") returns None on Windows

2012-07-18 Thread Nick Coghlan
New submission from Nick Coghlan : As noted in #15314, one of the pkgutil tests was failing on Windows because pkgutil.get_importer("") was returning None. On my Fedora system it returns FileFinder("."). I've now tweaked that particular test to use a bogus path st

[issue15384] FileFinder.path_hook()("") returns None on Windows

2012-07-18 Thread Nick Coghlan
Changes by Nick Coghlan : -- stage: -> test needed type: -> behavior ___ Python tracker <http://bugs.python.org/issue15384> ___ ___ Python-bugs-list

[issue15385] Behaviour change in runpy for __file__ attributes between 3.2 and 3.3

2012-07-18 Thread Nick Coghlan
New submission from Nick Coghlan : Directory setup: linkdir is a symlink to realdir $ python3 -c "import sys; sys.path.insert(0, 'linkdir'); import runpy; print(runpy.run_module('foo')['__file__'])" /home/ncoghlan/devel/play/realdir/foo.py $ ../py3k/

[issue15385] Behaviour change in runpy for __file__ attributes between 3.2 and 3.3

2012-07-18 Thread Nick Coghlan
Changes by Nick Coghlan : -- resolution: -> works for me status: open -> closed ___ Python tracker <http://bugs.python.org/issue15385> ___ ___ Python-bugs-

[issue15314] Use importlib instead of pkgutil in runpy

2012-07-18 Thread Nick Coghlan
Nick Coghlan added the comment: Buildbots are green (at least as far as this issue goes), so closing again. I created #15384 for the surprising behaviour of FileFinder on Windows. #15385 records my investigation into the odd symlink behaviour on 3.2 (it was just a discrepancy between the

[issue15386] Still getting two copies of importlib._boostrap

2012-07-18 Thread Nick Coghlan
New submission from Nick Coghlan : I haven't worked out how yet, but importlib.machinery is managing to bypass the replacement of importlib._bootstrap with _frozen_importlib: Python 3.3.0b1 (default:8bf691d0b004+, Jul 15 2012, 23:20:06) [GCC 4.7.0 20120507 (Red Hat 4.7.0-5)] on linux

[issue15386] Still getting two copies of importlib._bootstrap

2012-07-18 Thread Nick Coghlan
Changes by Nick Coghlan : -- title: Still getting two copies of importlib._boostrap -> Still getting two copies of importlib._bootstrap ___ Python tracker <http://bugs.python.org/issu

[issue15384] pkgutil.get_importer("") was returning None on Windows buildbots

2012-07-18 Thread Nick Coghlan
Nick Coghlan added the comment: Well, that's weird. A manual test on my Windows 7 gaming rig indicates that the old test *should* have worked on Windows as well. I have no idea how to investigate this further. David, are you able to check what pkgutil.get_importer("") retur

<    29   30   31   32   33   34   35   36   37   38   >