[issue12353] argparse cannot handle empty arguments
Torsten Landschoff t.landsch...@gmx.net added the comment: Your unit test isn't consistent with the other unit tests in that set, which makes me suspicious that it isn't testing what we need to test. That is because I did not try to understand the machinery behind the argparse unit tests completely. I did not want to create an extra unit test class just for this one test. Also, there are unit tests for this case further up in the test file (TestEmptyAndSpaceContainingArguments). I haven't been able to reproduce the bug. Did you run the unit tests from my patch? Can you post a short program that reproduces the failure? Here you go: from argparse import ArgumentParser parser = ArgumentParser(fromfile_prefix_chars=@) parser.parse_args([]) This gives me Traceback (most recent call last): File stdin, line 1, in module File /opt/python3/lib/python3.3/argparse.py, line 1726, in parse_args args, argv = self.parse_known_args(args, namespace) File /opt/python3/lib/python3.3/argparse.py, line 1758, in parse_known_args namespace, args = self._parse_known_args(args, namespace) File /opt/python3/lib/python3.3/argparse.py, line 1770, in _parse_known_args arg_strings = self._read_args_from_files(arg_strings) File /opt/python3/lib/python3.3/argparse.py, line 2003, in _read_args_from_files if arg_string[0] not in self.fromfile_prefix_chars: IndexError: string index out of range -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12353 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12353] argparse cannot handle empty arguments
Torsten Landschoff t.landsch...@gmx.net added the comment: Here is another possible patch that will catch the problem. But this enables the fromfile_prefix_chars option for all tests checking empty and space arguments. This way a problem that occurs only without that option might be hidden. We would need to run those tests with and without fromfile_prefix_chars. -- Added file: http://bugs.python.org/file22433/modify_test_empty.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12353 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11104] distutils sdist ignores MANIFEST
Stephen Thorne step...@thorne.id.au added the comment: I have 2 patches, with tests, that applies on python2.7 and the python3 series of branches, attached this ticket. I have also got a signed contributor agreement lodged with the PSF. Can I please have someone either apply my patches or tell me what I need to do in order to change them if they are being rejected. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11104 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12303] expose sigwaitinfo() and sigtimedwait() in the signal module
Ross Lagerwall rosslagerw...@gmail.com added the comment: Here's a patch to add the two functions (with docs and tests). You'll need to run autoreconf before compiling. -- assignee: - rosslagerwall keywords: +patch nosy: +rosslagerwall stage: - patch review type: - feature request Added file: http://bugs.python.org/file22434/issue12303.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12303 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11909] Doctest sees directives in strings when it should only see them in comments
Devin Jeanpierre jeanpierr...@gmail.com added the comment: You're right, and good catch. If a doctest starts with a #coding:XXX line, this should break. One option is to replace the call to tokenize.tokenize with a call to tokenize._tokenize and pass 'utf-8' as a parameter. Downside: that's a private and undocumented API. The alternative is to manually add a coding line that specifies UTF-8, so that any coding line in the doctest would be ignored. My preferred option would be to add the ability to read unicode to the tokenize API, and then use that. I can file a separate ticket if that sounds good, since it's probably useful to others too. One other thing to be worried about -- I'm not sure how doctest would treat tests with leading coding:XXX lines. I'd hope it ignores them, if it doesn't then this is more complicated and the above stuff wouldn't work. I'll see if I have the time to play around with this (and add more test cases to the patch, correspondingly) this weekend. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11909 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12361] Memory Leak in File Logging
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: Marked as pending since no further information is available. I will close this issue in two weeks unless more information becomes available; even after this, if you get more information, you can re-open this issue. Also please note that Python 2.6 is closed for changes other than security-related ones. -- status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12361 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12393] Packaging should provide support for extensible categories
New submission from Vinay Sajip vinay_sa...@yahoo.co.uk: Some installation locations are platform-dependent and cannot be categorised into a small but fixed number of categories. This is particularly true for the Windows ecosystem - PowerShell, Office, SharePoint all have specific locations where files need to be installed for interoperability with them. This can be catered for by a pre-hook for install_data, but some very small core changes are needed: 1. In the install_data constructor, initialise self.categories to an empty dictionary. 2. In install_data.expand_categories, add a local_vars.update(self.categories) after the local_vars = get_paths() statement. Just these small changes are sufficient to allow sufficient control over custom installation locations. For projects that need custom categories, they just need to do the necessary setup in an install_data pre-hook: def pre_install_data(cmd): cmd.categories['customcategory'] = '/path/for/my/custom/category' I have this working in the pythonv branch, and if the feature request is accepted I can work up a patch including changes to docs, tests etc. -- assignee: tarek components: Distutils2, Library (Lib) messages: 138895 nosy: alexis, eric.araujo, tarek, vinay.sajip priority: normal severity: normal status: open title: Packaging should provide support for extensible categories type: feature request versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12393 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12394] Packaging should provide better support for executable scripts on Windows
New submission from Vinay Sajip vinay_sa...@yahoo.co.uk: At present, packaging support for scripts on Windows is the same as for any other system. This is sub-optimal, for the following reasons: 1. Windows doesn't support #! lines to find the correct executable for a script. On a system with multiple Python versions and scripts written for particular versions, support for locating the correct needs to be present. 2. Windows has two types of executables - console applications and GUI applications - and Windows users expect correct usage of either python.exe or pythonw.exe, depending on the individual script being run. Setuptools (and therefore Distribute) support these requirements by installing a script demo, on Windows, as demo.exe and demo-script.py (or demo-script.pyw), where demo.exe is a stock Windows executable (either console or GUI) which invokes the appropriate Python executable on the demo-script.py[w] file. Packaging should provide a similar mechanism, which can be implemented very simply by changing the build_scripts command appropriately. It should work like this: 1. When writing a script, the developer simply provides a #!line as normal, but if intended for deployment on Windows, ensures the executable is named as pythonw rather than python. The script should have no extension, as would be for case for a script Linux or OS X. 2. On Windows, the build-scripts command will build the script as it does now - substituting the correct executable for the #! line - but on Windows, instead of writing the script out as e.g. demo, it will write it as either demo-script.py or demo-script.pyw (depending on whether the #! line had pythonw in it or not), and will also write a stock executable (either console or GUI, depending) with the corresponding name demo.exe. 3. Since install_scripts just copies files from the build directory, there shouldn't need to be any changes here. The stock executables can be the same as Distribute uses (setuptools/cli.exe and setuptools/gui.exe), if there is no licensing (or other) issue with having them in Python. If there is such an issue, they can be written from scratch to do the same job (it's just one C file). I have this working in the pythonv branch, and if this feature request is accepted then I can work up a patch with test and doc changes. (The build_scripts changes are quite straightforward.) -- assignee: tarek components: Distutils2, Library (Lib) messages: 138896 nosy: alexis, eric.araujo, tarek, vinay.sajip priority: normal severity: normal status: open title: Packaging should provide better support for executable scripts on Windows type: feature request versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12394 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12394] Packaging should provide better support for executable scripts on Windows
Tim Golden m...@timgolden.me.uk added the comment: Are you aware of PEP 397? http://www.python.org/dev/peps/pep-0397/ -- nosy: +tim.golden ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12394 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12303] expose sigwaitinfo() and sigtimedwait() in the signal module
STINNER Victor victor.stin...@haypocalc.com added the comment: Cool, a patch! Some comments. Why do you wait until the end of PyInit_signal() to set initialized to 1? If this variable is only present to call PyStructSequence_InitType() only once, you can set initialized to 1 directly in the if. Is it possible that PyInit_signal() is called more than once? C modules cannot be unloaded in Python, but I see that the init function of the posixmodule.c has also a static initialized variable. Doc: The sigwaitinfo()/sigtimedwait() manual page contains interesting infos: (If one of the signals in set is already pending for the calling thread, sigwaitinfo() will return immediately with information about that signal.) If both fields of this structure are specified as 0, a poll is performed: sigtimedwait() returns immediately, either with information about a signal that was pending for the caller, or with an error if none of the signals in set was pending. The manpage doesn't tell that the signal handler is not called, should we say it in the Python doc? Doc: you may add links between pause(), sigwait(), sigwaitinfo() and sigtimedwait() functions. We should maybe reorganise the signal doc to group functions. We need maybe a section for pending signals functions, functions to block or wait signals: pause(), pthread_sigmask(), sigpending(), sigwait(), sigwaitinfo(), sigtimedwait(). Another big theme of the signal module is signal handling. We may group functions by these two themes. Well, it is better to reorganize the doc is a second commit ;-) The timeout is a tuple. Usually, Python uses float for timeout (e.g. see select.select). I suppose that you chose a tuple to keep the precision of the timespec structure. We may accept both types: (sec: int, nanosec: int) or sec: float. It would be nice to have the opinion of our time expect, Alexander Belopolsky. It is possible to pass a negative timeout: the select() functions accepts or not negative timeout depending on the platform. In Python 3.3, select.select() now always raise an exception if the timeout is negative to have the same behaviour on all platforms. According to the Linux manual page, sigtimedwait() can return EINVAL if the timeout is invalid. We may also always raise an exception if the timeout is negative in sigtimedwait()? signal_sigwaitinfo() and signal_sigtimedwait() use iterable_to_sigset() whereas this function is only compiled if #if defined(PYPTHREAD_SIGMASK) || defined(HAVE_SIGWAIT). You have to fix this test. According to the manual page, sigwaitinfo() or sigtimedwait() can be interrupted (EINTR) by an unexpected signal (in signal not the signal set): you should call PyErr_CheckSignals(). You should add a test for this case. Your patch doesn't touch configure nor pyconfig.h.in, only configure.in. Edit configure manually (better to limit the size of the patch) and run autoheader to regenerate pyconfig.h.in (or maybe edit manually pyconfig.h.in). siginfo_t structure contains more fields, but I don't know if we need all of them. It can be improved later. sigtimedwait() raises a OSError(EGAIN) on timeout. The behaviour must be documented, or we can choose another behaviour. We may simply return None in case of a timeout, it is just more practical to use than a try/except. For example, threading.Lock.acquire(timeout) simply returns False in case of a timeout. select.select() returns ([], [], []) in case of a timeout, not an exception. test_sigtimedwait_timeout(): why do you call signal.alarm()? You may also add a test for timeout=0, I suppose that it is a special timeout value. I will do a deeper review on the second version of your patch :-) Thanks again for the patch. I tried to write it, but I was bored of the siginfo_t fields (too many fields, and I didn't know how to expose them in Python). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12303 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12394] Packaging should provide better support for executable scripts on Windows
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: @Tim: It had gone under my radar, thanks for the link! I don't know if/when it will be accepted (i.e. whether before 3.3), so my suggestion could be considered as a fallback alternative which works now. If the PEP 397 launcher is available, then of course we should use that. Of course PEP 397 does not support 'pythonw' in shebang lines, but the pythonw I am suggesting here will not appear in the final output script anyway. It's more of a hint to build_scripts indicating the launcher to use. It seems this choice is still required, since from a quick reading of PEP 397, I couldn't see how the user could just type demo for an eponymous script in a virtualenv and get the correct launcher (console or GUI). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12394 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12394] Packaging should provide better support for executable scripts on Windows
Tim Golden m...@timgolden.me.uk added the comment: Adding Mark H as the author of PEP 397 -- nosy: +mhammond ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12394 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11104] distutils sdist ignores MANIFEST
Éric Araujo mer...@netwok.org added the comment: I have outstanding comments and questions on the review page (follow the review link on the right of the 3.x patch). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11104 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12394] Packaging should provide better support for executable scripts on Windows
Éric Araujo mer...@netwok.org added the comment: My GSoC student will work on integrating the scripts generation from setuptools into packaging. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12394 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11104] distutils sdist ignores MANIFEST
Stephen Thorne step...@thorne.id.au added the comment: Oh! I didn't see any notification that there was a review done. Thanks, I'll attend to that. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11104 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12191] Add shutil.chown to allow to use user and group name (and not only uid/gid)
Éric Araujo mer...@netwok.org added the comment: haypo, you missed this comment from gps on Rietveld: As for the _user = user stuff, the reason that is being done is so that the original user and or group value can be included in the raised exception error message. That is actually a nice thing to do. otherwise, yes, i'd normally just reassign the parameters. At this point I believe this patch is ready to commit. I'd reword the docstring to make it simpler but that is a minor detail and something that is easy to change in a future commit. I agree the patch is ready. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12191 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12388] cannot specify recursive extra_files in packaging setup.cfg
Éric Araujo mer...@netwok.org added the comment: +1. We have a function in the util module to handle such extended globs (it’s used by the resources code), so this should not be hard. -- stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12388 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12394] Packaging should provide better support for executable scripts on Windows
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: Éric, what will be the scope of that integration? Please bear in mind, I have a working solution, so there's no need to cover this part again unless you think there's a problem with my implementation. The changes were straightforward, see https://bitbucket.org/vinay.sajip/pythonv/changeset/d2453f281baf -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12394 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12393] Packaging should provide support for extensible categories
Éric Araujo mer...@netwok.org added the comment: I think this should be part of the setup.cfg specification, not an install_data hook. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12393 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions
sorin sorin.sbar...@gmail.com added the comment: Can we get more info regarding resolution of this bug. Due to this bug httplib cannot be used anymore to send binary data. This bug breaks other modules, one example being PyAMF (that does communicate only using binary data). -- nosy: +sorin ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11898 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12394] Packaging should provide better support for executable scripts on Windows
Éric Araujo mer...@netwok.org added the comment: In the setup.cfg files, scripts will now be a mapping of names to callables, like the setuptools scripts and gui_scripts entry points: scripts = sphinx-build = sphinx.build.run On UNIX, a Python script named sphinx-build will be created, on Windows, a binary sphinx-build.exe will be created. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12394 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12393] Packaging should provide support for extensible categories
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: @Éric: I agree that some support in setup.cfg would be good, but the problem is that you can't be 100% declarative - sometime the locations can only be determined at runtime. I assume you are thinking of something like: [install_data] categories = cat1 = path1 cat2 = path2 In my specific use case, declarative paths will not work in all scenarios - you have to use ctypes to call a Windows API (SHGetKnownFolderPath) to find the specific place to put things. The two approaches can work together - the categories dictionary can be populated from setup.cfg where this makes sense, and of course for static paths it makes perfect sense. The Windows world is a lot more chaotic than static paths can cater for, unfortunately :-( -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12393 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12394] Packaging should provide better support for executable scripts on Windows
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: Does that mean that you can't just put an arbitrary Python script in your application? You have to structure it as a callable? Of course, I see the applicability of it for the entry_points functionality of setuptools. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12394 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12242] distutils2 environment marker for current compiler
Éric Araujo mer...@netwok.org added the comment: Thanks! This patch was made against the hg.python.org/cpython repo. This is good. See http://wiki.python.org/moin/Distutils/Contributing I'm not sure where I should add documentation about this new behavior. At least in Doc/library/packaging.compiler.rst and Doc/packaging/setupcfg.rst, maybe in Doc/install too. This feature could probably use some unittests to be added as well. Yes. You can see how we use mocking in test_unixccompiler.py or test_util.py to test real-world program output and make sure our code parses it right. This doesn't seem right to me, as -- is frequently found in options strings, and I'd expect it to cause problems. If this is a bug in extra_compile_args, I'm happy to create a separate bug and submit a patch. Please do. I’ll look into the history to see whether there was a comment about that, but this really looks like a bug. The separator should be something that can’t be part of options strings, like “;”. -- assignee: tarek - eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12242 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12386] packaging fails in install_distinfo when writing RESOURCES
Éric Araujo mer...@netwok.org added the comment: It is strange that neither the tests for install_distinfo and resources did not catch this. I agree about the nonsense of opening in binary mode. -- assignee: tarek - eric.araujo stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12386 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions
sorin sorin.sbar...@gmail.com added the comment: There is another problem that makes the problem even more critical. OS X 10.7 does include Python 2.7.1 as the *default* interpreter. So we'll need both a fix for the future and an workaround. BTW, the hack with sys.setdefaultencoding cannot be used if you really send binary data. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11898 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12223] Datamodel documentation page: 'operator' where 'operand' should be
Changes by Eli Bendersky eli...@gmail.com: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12223 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12394] Packaging should provide better support for executable scripts on Windows
Éric Araujo mer...@netwok.org added the comment: Does that mean that you can't just put an arbitrary Python script in your application? Arbitrary script files are supported via the resources feature (when the bug you reported is fixed :) The generation of scripts from callables is a widely-used setuptools feature that will solve a number of problems (Python not on PATH on Windows, unnecessary .py extension on UNIX, such things). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12394 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5572] distutils ignores the LIBS configure env var
Éric Araujo mer...@netwok.org added the comment: I’m afraid performance improvements are not bug fixes, which are the only possible changes in distutils now. This change is however appreciated for packaging. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5572 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12395] packaging remove fails under Windows
New submission from Vinay Sajip vinay_sa...@yahoo.co.uk: pysetup3 remove projectX fails on Windows. The reason is that the RECORD file can't be moved, as it's still open (we're using a generator in list_installed_files). Apart from fixing that, a related annoyance is that you get the [Error 32] The process cannot access the file because it is being used by another process but, of course, it doesn't tell you *which* file it failed on. So the error message needs to say which file(s) couldn't be moved. -- assignee: tarek components: Distutils2, Library (Lib) messages: 138917 nosy: alexis, eric.araujo, tarek, vinay.sajip priority: normal severity: normal status: open title: packaging remove fails under Windows type: behavior versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12395 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12394] Packaging should provide better support for executable scripts on Windows
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: Then for Unix at least, how will the installer know which resources need the execute permission turned on? Just by the destination? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12394 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12395] packaging remove fails under Windows
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: I can confirm that putting a list() around the generator allows the removal to proceed: diff -r d2453f281baf Lib/packaging/install.py --- a/Lib/packaging/install.py Fri Jun 24 10:21:46 2011 +0100 +++ b/Lib/packaging/install.py Fri Jun 24 12:48:33 2011 +0100 @@ -389,7 +389,10 @@ dist = get_distribution(project_name, use_egg_info=True, paths=paths) if dist is None: raise PackagingError('Distribution %s not found' % project_name) -files = dist.list_installed_files(local=True) +# list_installed_files returns a generator, and we need the +# RECORD file itself closed so that we can move it - under Windows, +# you can't move an opened file +files = list(dist.list_installed_files(local=True)) rmdirs = [] rmfiles = [] tmp = tempfile.mkdtemp(prefix=project_name + '-uninstall') The error message does need fixing, though, for cases where something else has a distribution's files open. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12395 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12395] packaging remove fails under Windows
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: I can confirm that putting a list() around the generator allows the removal to proceed: diff -r d2453f281baf Lib/packaging/install.py --- a/Lib/packaging/install.py Fri Jun 24 10:21:46 2011 +0100 +++ b/Lib/packaging/install.py Fri Jun 24 12:48:33 2011 +0100 @@ -389,7 +389,10 @@ dist = get_distribution(project_name, use_egg_info=True, paths=paths) if dist is None: raise PackagingError('Distribution %s not found' % project_name) -files = dist.list_installed_files(local=True) +# list_installed_files returns a generator, and we need the +# RECORD file itself closed so that we can move it - under Windows, +# you can't move an opened file +files = list(dist.list_installed_files(local=True)) rmdirs = [] rmfiles = [] tmp = tempfile.mkdtemp(prefix=project_name + '-uninstall') The error message does need fixing, though, for cases where something else has a distribution's files open. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12395 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12395] packaging remove fails under Windows
Changes by Vinay Sajip vinay_sa...@yahoo.co.uk: -- Removed message: http://bugs.python.org/msg138920 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12395 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12386] packaging fails in install_distinfo when writing RESOURCES
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: I suppose it's because I'm writing a script as if it were data? (i.e. to the {scripts} location. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12386 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12394] Packaging should provide better support for executable scripts on Windows
Éric Araujo mer...@netwok.org added the comment: The copy function used will preserve rights. IOW, the +x will be needed in the source. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12394 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12395] packaging remove fails under Windows
Éric Araujo mer...@netwok.org added the comment: So the error message needs to say which file(s) couldn't be moved. Isn’t that a Windows error message which we have no control on? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12395 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12296] Minor clarification in devguide
Éric Araujo mer...@netwok.org added the comment: What about this: (this obviously does not apply to new classes, functions or arguments) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12296 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12395] packaging remove fails under Windows
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: We could fix the error message, for example, like this: --- a/Lib/packaging/install.py Fri Jun 24 10:21:46 2011 +0100 +++ b/Lib/packaging/install.py Fri Jun 24 13:06:08 2011 +0100 @@ -412,6 +415,7 @@ error = _move_file(file_, tmpfile) if error is not None: success = False +failed_on = file_ break finally: if not os.path.isfile(file_): @@ -425,7 +429,7 @@ if not success: logger.info('%r cannot be removed.', project_name) -logger.info('Error: %s' % str(error)) +logger.info('Error: %s: %s' % (error, failed_on)) return False logger.info('Removing %r: ', project_name) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12395 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10403] Use member consistently
Éric Araujo mer...@netwok.org added the comment: I used methods and attribute in io.rst because BufferedIOBase included one attribute and several methods. My terminology may be off, but I felt this was the correct replacement of members. Nearly :) See in the first message: Members and methods should just be attributes. -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10403 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12379] build outside source fail in head
Éric Araujo mer...@netwok.org added the comment: Out-of-tree configure also fails because of missing .o files. -- nosy: +dmalcolm, eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12379 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12396] Delivery failed
Éric Araujo mer...@netwok.org added the comment: This should go to the meta-tracker. -- nosy: +eric.araujo resolution: - invalid stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12396 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12395] packaging remove fails under Windows
Éric Araujo mer...@netwok.org added the comment: Ah, nice, just use %r for the filename. I’ll commit this improvement in a few days. Do you want to write a test for the remove error? -- assignee: tarek - eric.araujo stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12395 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11933] newer() function in dep_util.py mixes up new vs. old files due stat.st_mtime vs stat
Éric Araujo mer...@netwok.org added the comment: Thanks, I’ll commit shortly. -- assignee: tarek - eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11933 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12394] packaging: generate scripts from callable (dotted paths)
Changes by Éric Araujo mer...@netwok.org: -- assignee: tarek - eric.araujo nosy: +higery stage: - needs patch title: Packaging should provide better support for executable scripts on Windows - packaging: generate scripts from callable (dotted paths) ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12394 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4015] Make installed scripts executable on windows
Changes by Éric Araujo mer...@netwok.org: -- resolution: - duplicate stage: - committed/rejected status: open - closed superseder: - packaging: generate scripts from callable (dotted paths) ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4015 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4015] Make installed scripts executable on windows
Éric Araujo mer...@netwok.org added the comment: We’re going to follow setuptools’ lead and generate platform-appropriate script or binary files from callables. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4015 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10403] Use member consistently
Adam Woodbeck adam.woodb...@gmail.com added the comment: I was always under the impression attributes and methods were mutually exclusive. I've corrected the patch as requested. -- Added file: http://bugs.python.org/file22436/issue10403_v2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10403 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1004696] translate Windows newlines when installing scripts on POSIX
Éric Araujo mer...@netwok.org added the comment: FTR, We’re going to follow setuptools’ lead and generate platform-appropriate script or binary files from callables. -- superseder: Scripts need platform-dependent handling - packaging: generate scripts from callable (dotted paths) ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1004696 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue870479] Scripts need platform-dependent handling
Éric Araujo mer...@netwok.org added the comment: All right, we’re going to follow setuptools’ lead and generate platform-appropriate script or binary files from callables. See the superseder bug report to follow the work that will be done during this summer’s GSoC. -- resolution: - duplicate stage: test needed - committed/rejected status: open - closed superseder: - packaging: generate scripts from callable (dotted paths) versions: +Python 3.3 -3rd party ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue870479 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue976869] Stripping script extensions with distutils
Éric Araujo mer...@netwok.org added the comment: We’re going to follow setuptools’ lead and generate platform-appropriate script or binary files from callables. -- resolution: - duplicate stage: patch review - committed/rejected status: open - closed superseder: - packaging: generate scripts from callable (dotted paths) versions: +Python 3.3 -3rd party ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue976869 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12397] re match object methods have no docstrings
New submission from Ned Batchelder n...@nedbatchelder.com: If I have a match object in hand, and ask for help on its methods, there is no information: m = re.match(a, a) help(m.group) Help on built-in function group: group(...) -- messages: 138937 nosy: nedbat priority: normal severity: normal status: open title: re match object methods have no docstrings type: behavior versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12397 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12394] packaging: generate scripts from callable (dotted paths)
Éric Araujo mer...@netwok.org added the comment: Short review of the superseded bugs. #870479 — Scripts need platform-dependent handling A request to remove .py on POSIX and create a .cmd file on Windows. The .cmd part was quickly shot down (see bug thread for problems), and the discussion moved to the setuptools generation. Interesting comment by a Windows user: In principle I don't have a problem with the automatic generation of an EXE (I assume it generates a shell script with no extension on Unix?) but it should be done in such a way that the EXE is version-independent. This is necessary to ensure that pure-python packages, when made into bdist_wininst installers, continue to be version-independent. (At the moment, distutils generates version-dependent bdist_wininst packages *only* for C extensions. Setuptools generates version-dependent installers all the time, which is a pain). This may mean that a reimplementation is required, rather than copying the setuptools code. The bug links to a thread on distutils-sig, where we can find one more issue by Robert Kern: In the generated script, please use if __name__ == '__main__': to block out the executable bits. Currently, multiprocessing does not work on Windows when the application is started by a console_script. Because Windows does not have a true fork, multiprocessing will start up clean Python subprocesses that import the __main__ of the parent process. (http://mail.python.org/pipermail/distutils-sig/2009-February/010981.html) #976869 — Stripping script extensions with distutils A patch by Fred Drake (distutils hacker) to build_scripts to remove the unneeded .py on POSIX. #1004696 — translate Windows newlines when installing scripts on POSIX A request that scripts created with CRLF be installed with LF on POSIX, to make the shebang mechanism work. #4015 — Make installed scripts executable on windows A patch to add a .bat file for each script (the .bat runs the .py). Contains the first discussion about a launcher for Windows (PEP 397), and issues with .exe files. So, Tarek and Fred have expressed support for the setuptools generation in a handful of bug reports and emails, and a number of users report they like it. IIUC, setuptools supports using python vs. pythonw on Windows (console vs. GUI), but is not flexible enough about which Python version to use, and does not support installing into bin vs. sbin on UNIX (see http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard to learn more about /bin, /sbin, /usr/bin and /usr/sbin). The cli.exe and gui.exe files look like they can be reused, but the install_scripts code will require more work. Another interesting thread that was linked from one of the reports: http://mail.python.org/pipermail/distutils-sig/2004-July/004071.html Finally, when the script generation is implemented and documented, care should be taken to add some doc about old-style script files compatibility. Projects can have valid reasons to use files for Python scripts, and need a way to install them. Issues about shebang edition (the distutils behavior in build_scripts) and newlines translation (#1004696) will need thought. -- nosy: +fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12394 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12393] Packaging should provide support for extensible categories
Éric Araujo mer...@netwok.org added the comment: I assume you are thinking of something like: Yep. In my specific use case, declarative paths will not work in all scenarios - you have to use ctypes to call a Windows API (SHGetKnownFolderPath) to find the specific place to put things. Ah, too bad. The two approaches can work together Yes. Let’s implement this in setup.cfg and document how to write a hook to call Windows APIs to get app-specific paths. See also #7175. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12393 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7175] Define a standard location and API for configuration files
Éric Araujo mer...@netwok.org added the comment: See also #12393. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7175 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11104] distutils sdist ignores MANIFEST
Stephen Thorne step...@thorne.id.au added the comment: This patch is an updated patch that fixes the things noted in the review from eric.araujo. -- Added file: http://bugs.python.org/file22437/manifest-respect-3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11104 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10403] Use member consistently
Changes by Adam Woodbeck adam.woodb...@gmail.com: Added file: http://bugs.python.org/file22438/issue10403_v3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10403 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12303] expose sigwaitinfo() and sigtimedwait() in the signal module
Ross Lagerwall rosslagerw...@gmail.com added the comment: Thanks for the review. Why do you wait until the end of PyInit_signal() to set initialized to 1? Fixed. If this variable is only present ... but I see that the init function of the posixmodule.c has also a static initialized variable. I simply followed the same format of the posix module. (If one of the signals in set is already pending for the calling thread, sigwaitinfo() will return immediately with information about that signal.) Added. If both fields of this structure are specified as 0, a poll is performed: sigtimedwait() returns immediately, either with information about a signal that was pending for the caller, or with an error if none of the signals in set was pending. Added. The manpage doesn't tell that the signal handler is not called, should we say it in the Python doc? Added - let's rather be more explicit. Doc: you may add links between pause(), sigwait(), sigwaitinfo() and sigtimedwait() functions. Added. The timeout is a tuple. Usually, Python uses float for timeout (e.g. see select.select). I suppose that you chose a tuple to keep the precision of the timespec structure. We may accept both types: (sec: int, nanosec: int) or sec: float. It would be nice to have the opinion of our time expect, Alexander Belopolsky. The are some uses of this tuple that were added in #10812 (e.g. futimens) that was reviewed by Alexander. However, there was a conflict about it at #11457. I'd say for now, let's keep it as a tuple and if a decision is eventually made as to how to represent nanosecond timestamps, we can change them all then. It is possible to pass a negative timeout It now raises an exception like select. signal_sigwaitinfo() and signal_sigtimedwait() use iterable_to_sigset() Fixed. According to the manual page, sigwaitinfo() or sigtimedwait() can be interrupted (EINTR) Actually, PyErr_SetFromErrno() does this implicitly. I added a test case anyway. Your patch doesn't touch configure nor pyconfig.h.in, only configure.in. I prefer to keep the generated changes out of the patch. When I commit, I'll run autoreconf. siginfo_t structure contains more fields, but I don't know if we need all of them. It can be improved later. POSIX 2008 specifies: int si_signo Signal number. int si_code Signal code. int si_errno If non-zero, an errno value associated with this signal, as described in errno.h. pid_t si_pidSending process ID. uid_t si_uidReal user ID of sending process. void *si_addr Address of faulting instruction. int si_status Exit value or signal. long si_band Band event for SIGPOLL. union sigval si_value Signal value. So I've left out si_addr (I don't think it's needed), si_band (we don't have SIGPOLL) and si_value (not sure what it's for or how to represent a union :-)). sigtimedwait() raises a OSError(EGAIN) on timeout. It now returns None. test_sigtimedwait_timeout(): why do you call signal.alarm()? Copy/paste error. You may also add a test for timeout=0, I suppose that it is a special timeout value. Added. I will do a deeper review on the second version of your patch :-) How much more in depth can it get ;-) ? -- Added file: http://bugs.python.org/file22439/issue12303_v2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12303 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12394] packaging: generate scripts from callable (dotted paths)
Fred L. Drake, Jr. fdr...@acm.org added the comment: People working on this should probably also look at how zc.buildout's zc.recipe.egg handles script generation. It's similar to setuptools in that console_script entry points are used, but it binds in the desired Python executable as well. (If you ran the build with an unversioned Python executable name, that's what you get, but if you use a versioned path, it's retained.) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12394 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12394] packaging: generate scripts from callable (dotted paths)
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: Short review of the superseded bugs. #870479 — Scripts need platform-dependent handling A request to remove .py on POSIX and create a .cmd file on Windows. The .cmd part was quickly shot down (see bug thread for problems), and the discussion moved to the setuptools generation. Interesting comment by a Windows user: In principle I don't have a problem with the automatic generation of an EXE (I assume it generates a shell script with no extension on Unix?) but it should be done in such a way that the EXE is version-independent. This is necessary to ensure that pure-python packages, when made into bdist_wininst installers, continue to be version-independent. (At the moment, distutils generates version-dependent bdist_wininst packages *only* for C extensions. Setuptools generates version-dependent installers all the time, which is a pain). I don't see how it makes sense to aim for version independence, especially since 2.x and 3.x can each raise SyntaxErrors when presented with the other's code. Isn't explicit better than implicit here? This may mean that a reimplementation is required, rather than copying the setuptools code. There's not much sense in making a simplistic copy, that's for sure. The bug links to a thread on distutils-sig, where we can find one more issue by Robert Kern: In the generated script, please use if __name__ == '__main__': to block out the executable bits. Currently, multiprocessing does not work on Windows when the application is started by a console_script. Because Windows does not have a true fork, multiprocessing will start up clean Python subprocesses that import the __main__ of the parent process. (http://mail.python.org/pipermail/distutils-sig/2009-February/010981.html) FYI I have a scriptize script that generates scripts for entry points, example is at https://gist.github.com/1044799 which is Windows-friendly (it doesn't refer to xxx-script.py in usage messages, for example), and may be of interest. So, Tarek and Fred have expressed support for the setuptools generation in a handful of bug reports and emails, and a number of users report they like it. IIUC, setuptools supports using python vs. pythonw on Windows (console vs. GUI), but is not flexible enough about which Python version to use, and does not support installing into bin vs. sbin on UNIX (see http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard to learn more about /bin, /sbin, /usr/bin and /usr/sbin). The cli.exe and gui.exe files look like they can be reused, but the install_scripts code will require more work. For the /bin, /sbin, /usr/bin or /usr/sbin issue, sure - but doesn't it make sense to do the other stuff in build_scripts? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12394 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12394] packaging: generate scripts from callable (dotted paths)
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: Fred L. Drake, Jr. fdr...@acm.org added the comment: People working on this should probably also look at how zc.buildout's zc.recipe.egg handles script generation. It's similar to setuptools in that console_script entry points are used, but it binds in the desired Python executable as well. (If you ran the build with an unversioned Python executable name, that's what you get, but if you use a versioned path, it's retained.) And also consider what happens when a script is installed into a virtual env, when the virtual env's executable *has* to be used. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12394 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12353] argparse cannot handle empty arguments
R. David Murray rdmur...@bitdance.com added the comment: Ah, I see now. I misread the original traceback. Creating a new test case would be the appropriate way to go, given the structure of the argparse test suite. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12353 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12353] argparse cannot handle empty arguments
R. David Murray rdmur...@bitdance.com added the comment: Actually, your original test might be fine. Let me double check the test implementation. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12353 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11909] Doctest sees directives in strings when it should only see them in comments
R. David Murray rdmur...@bitdance.com added the comment: I agree that having a unicode API for tokenize seems to make sense, and that would indeed require a separate issue. That's a good point about doctest not otherwise supporting coding cookies. Those only really apply to source files. So no doctest fragments ought to contain coding cookies at the start, so your patch ought to be fine. But I'm not familiar with the doctest internals, so having some tests to prove everything is fine would be great. Your code could use the tokenize sniffer to make sure the fragment reads as utf-8 and throw an error otherwise. But using a unicode interface to tokenize would probably be cleaner, since I suspect it would mimic what doctest does otherwise (ignore coding cookies). But I don't *know* the latter, so your checking it would be appreciated. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11909 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12291] file written using marshal in 3.2 can be read by 2.7, but not 3.2 or 3.3
Changes by Vinay Sajip vinay_sa...@yahoo.co.uk: Added file: http://bugs.python.org/file22440/ab1c38ffb8d4.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12291 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12393] Packaging should provide support for extensible categories
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: Yes. Let’s implement this in setup.cfg and document how to write a hook to call Windows APIs to get app-specific paths. See also #7175. When you say let's, do you mean me, or you? :-) Just so we don't *both* do it ... Re. #7175, the discussion is somewhat orthogonal - the other issue ISTM is really about where to map appdata.* categories. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12393 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12356] more argument error improving
Roundup Robot devnull@devnull added the comment: New changeset 52744a5a9260 by Benjamin Peterson in branch 'default': give the names of missing positional or keyword-only arguments (closes #12356) http://hg.python.org/cpython/rev/52744a5a9260 -- nosy: +python-dev resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12356 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6474] Inconsistent TypeError message on function calls with wrong number of arguments
Benjamin Peterson benja...@python.org added the comment: Maybe #12356 then? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6474 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions
Senthil Kumaran sent...@uthcode.com added the comment: Sorin, can you please open another report with more details and how some condition in httplib breaks PyAMF. We will see through that it is fixed. Commenting on an invalid closed issue is confusing. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11898 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12398] Sending binary data with a POST request in httplib can cause Unicode exceptions
New submission from sorin sorin.sbar...@gmail.com: It looks that Python 2.7 changes did induce some important bugs into httplib due to to implicit str-unicode encoding/decoding. One clear example is that PyAMF library doesn't work with Python 2.7 because it is not able to generate binary data POST responses. Please check http://dev.pyamf.org/ticket/823 (partial trackback, full in above bug) File /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py, line 937, in endheaders self._send_output(message_body) File /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py, line 795, in _send_output msg += message_body -- messages: 138953 nosy: sorin priority: normal severity: normal status: open title: Sending binary data with a POST request in httplib can cause Unicode exceptions type: crash versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12398 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions
sorin sorin.sbar...@gmail.com added the comment: Added as bug http://bugs.python.org/issue12398 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11898 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10206] python program starting with unmatched quote spews spaces to stdout
Francisco Martín Brugué franci...@email.de added the comment: I've attached an alternative test case. I'm not sure if there is a more robust way to test: self.assert_('SyntaxError' in err.decode('ascii', 'ignore')) Due the use of 'SyntaxtError' directly as string. I would prefer something like str(SyntaxtError) (or just the name of the exception without extra text) Review is welcome -- nosy: +francismb Added file: http://bugs.python.org/file22441/issue10206.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10206 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12399] make cell var initialization more efficient
New submission from Benjamin Peterson benja...@python.org: Initializing cell variables currently involves 2 nested loops every function call. This patch makes that process much more efficient by saving information which doesn't change every function call to the code object. -- components: Interpreter Core files: bettercells.patch keywords: patch messages: 138956 nosy: benjamin.peterson, ncoghlan priority: normal severity: normal stage: patch review status: open title: make cell var initialization more efficient type: performance versions: Python 3.3 Added file: http://bugs.python.org/file22442/bettercells.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12399 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10206] python program starting with unmatched quote spews spaces to stdout
R. David Murray rdmur...@bitdance.com added the comment: I think that self.assertRegex(err.decode('ascii', 'ignore'), 'SyntaxError') would be fine. We are extremely unlikely to change the string representation of the name of SyntaxError or omit it from the error message, so I think this is a reliable test. If you really want to be paranoid, you could use SyntaxError.__name__ as the argument to assertRegex, but there are a number of other places in the test suite where we hardcode the exception names, so I don't think it is necessary. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10206 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5572] distutils ignores the LIBS configure env var
Collin Winter coll...@gmail.com added the comment: I have no interest in forward-porting the patch, closing accordingly. At least there will be a record of this patch for anyone interested in getting a free 10% performance boost for their Python 2.x or 3.[012] systems. -- assignee: tarek - eric.araujo resolution: - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5572 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12397] re match object methods have no docstrings
SilentGhost ghost@gmail.com added the comment: 2.6 is in security-only mode, if I'm not mistaken. -- nosy: +SilentGhost versions: -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12397 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10206] python program starting with unmatched quote spews spaces to stdout
Francisco Martín Brugué franci...@email.de added the comment: Just attaching the review patch -- Added file: http://bugs.python.org/file22443/issue10206v2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10206 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10206] python program starting with unmatched quote spews spaces to stdout
Francisco Martín Brugué franci...@email.de added the comment: On 06/24/2011 06:07 PM, R. David Murray wrote: self.assertRegex(err.decode('ascii', 'ignore'), 'SyntaxError') I understand that's the standard way to check if a given failure happened in the command line or there is also a helper for that case (maybe something: assert_python_raises('-c', ', SyntaxError)) Thanks ! Francisco -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10206 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12399] make cell var initialization more efficient
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12399 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12372] semaphore errors on AIX 7.1
Charles-François Natali neolo...@free.fr added the comment: Nobody is able to get more information, or maybe nobody wants to dig this issue. It would be better to get the real cause of the issue, Well, it looks like a libc or kernel bug, and we probably can't do much about it. Just falling back to mutex + condition variable instead of POSIX semaphores does the trick, so I'll say just avoid POSIX semaphores altogether on AIX and we should be fine. People could report this to their AIX vendor, but they should definitely consider dropping this terminally broken platform and switch to, let's says, Linux or BSD... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12372 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12399] make cell var initialization more efficient
Jesús Cea Avión j...@jcea.es added the comment: Could you possibly post a before/after timing comparison?. Some realistic code... Post the test code too. And yes, I know that the difference will depend of code, and hardware architecture. But some references are better that not reference at all. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12399 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12399] make cell var initialization more efficient
Benjamin Peterson benja...@python.org added the comment: 2011/6/24 Jesús Cea Avión rep...@bugs.python.org: Jesús Cea Avión j...@jcea.es added the comment: Could you possibly post a before/after timing comparison?. Some realistic code... Post the test code too. And yes, I know that the difference will depend of code, and hardware architecture. But some references are better that not reference at all. Well, I don't really care whether it's faster or not. It's much nicer looking now, though. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12399 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12393] Packaging should provide support for extensible categories
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: Basic support for categories now added to install_data: https://bitbucket.org/vinay.sajip/pythonv/changeset/a4822be62d90 I couldn't see a packaging.util function for matching lines of type key = value, but if there's one I missed, I can change the implementation to suit. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12393 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10206] python program starting with unmatched quote spews spaces to stdout
Roundup Robot devnull@devnull added the comment: New changeset 2a4764376c51 by R David Murray in branch '3.2': #10206: add test for previously fixed bug. http://hg.python.org/cpython/rev/2a4764376c51 New changeset 5ec95f46bac5 by R David Murray in branch 'default': Merge #10206: add test for previously fixed bug. http://hg.python.org/cpython/rev/5ec95f46bac5 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10206 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10206] python program starting with unmatched quote spews spaces to stdout
R. David Murray rdmur...@bitdance.com added the comment: Thanks, Petri and Francisco. Eric, I'm closing this since we now have a minimal test. If you still want to go back and add more tests based on a deeper understanding of what was broken, feel free to reopen the issue. -- resolution: - fixed stage: test needed - committed/rejected status: open - closed versions: +Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10206 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12399] make cell var initialization more efficient
Jesús Cea Avión j...@jcea.es added the comment: Then change the issue title :-p. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12399 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12399] make cell var initialization more efficient
Benjamin Peterson benja...@python.org added the comment: The attached highly braindead benchmark reports about a 2% improvement. -- Added file: http://bugs.python.org/file22444/x.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12399 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12392] pthread_kill() doesn't work on the main thread on FreeBSD6
Charles-François Natali neolo...@free.fr added the comment: Attached patch implements the suggested fix. The patch looks good to me. It would be possible to fix the test to fail instead of blocking I think this issue deserves a specific test, since: - test_pending tests something completely different - at the time test_pending gets to run, there's a high chance that threads have already been created I've attached a patch spawning a new interpreter to test that. -- Added file: http://bugs.python.org/file22445/pthread_kill_main_thread.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12392 ___diff -r 5ec95f46bac5 Lib/test/test_signal.py --- a/Lib/test/test_signal.py Fri Jun 24 13:28:08 2011 -0400 +++ b/Lib/test/test_signal.py Fri Jun 24 20:01:37 2011 +0200 @@ -295,6 +295,31 @@ self.check_signum(signum1, signum2) +@unittest.skipUnless(hasattr(signal, 'pthread_kill'), + 'need signal.pthread_kill()') +def test_pthread_kill_main_thread(self): +# Test that a signal can be sent to the main thread with pthread_kill() +# before any other thread has been created (see issue #12392). +code = if True: +import threading +import signal +import sys + +def handler(signum, frame): +sys.exit(3) + +signal.signal(signal.SIGUSR1, handler) +signal.pthread_kill(threading.get_ident(), signal.SIGUSR1) +sys.exit(0) + + +with spawn_python('-c', code) as process: +stdout, stderr = process.communicate() +exitcode = process.wait() +if exitcode != 3: +raise Exception(Child error (exit code %s): %s % +(exitcode, stdout)) + def setUp(self): import fcntl ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12398] Sending binary data with a POST request in httplib can cause Unicode exceptions
R. David Murray rdmur...@bitdance.com added the comment: If this worked in 2.6 and fails in 2.7, it would probably be helpful if we can determine what change broke it. I believe hg has some sort of 'bisect' support that might make this not too onerous to do. Senthil (or someone) will eventually either figure out the problem or do the bisect, but if you want to speed things along you could do the bisect. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12398 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions
Terry J. Reedy tjre...@udel.edu added the comment: Soren, this is an issue that claimed a bug, not a bug. The resolution is that the claim appears false because the problem arose from using unicode rather than bytes url. The error message may be confusing, but the error class cannot be changed. Senthil says that he *did* send non-ascii bytes with no problem. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11898 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12392] pthread_kill() doesn't work on the main thread on FreeBSD6
Roundup Robot devnull@devnull added the comment: New changeset 024827a9db64 by Victor Stinner in branch 'default': Issue #12392: fix thread initialization on FreeBSD 6 http://hg.python.org/cpython/rev/024827a9db64 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12392] pthread_kill() doesn't work on the main thread on FreeBSD6
STINNER Victor victor.stin...@haypocalc.com added the comment: I've attached a patch spawning a new interpreter to test that. Thanks, I commited your test at the same time of the fix. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12374] Execution model should explain compile vs definition vs execution time
Changes by Daniel Urban urban.dani...@gmail.com: -- nosy: +durban ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12374 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12398] Sending binary data with a POST request in httplib can cause Unicode exceptions
Terry J. Reedy tjre...@udel.edu added the comment: A crash is a segfault or equivalent. Python 2.6 only gets security fixes. PyAMF does not run on Python 3. Hence a problem with PyAMF is no evidence of a problem with 3.x. Separate tests/examples would be needed. Changes are not bugs unless they introduce a discrepancy between code and doc. Please post a self-contained example that exhibits the behavior that you consider a problem. It should not just be a repeat of #11898. Then quote the section of the docs that says (or suggests) that the behavior should be different from what it is. The PyAMF site says PyAMF requires Python 2.4 or newer. Python 3.0 isn’t supported yet. Since 3.0 was deprecated 2 years ago with the release of 3.1, I strongly suspect that the statement was written before 2.7 was released a year ago. Library developers should not make open ended promises like 'or newer' -- certainly not without testing and revising as necessary with each new Python version. If PyAMF was broken by planned, announced, and documented changed in 2.7, that is too bad, but it is a year too late to change 2.7. Like all new versions, it had public beta and release candidate phases when people could test their packages and make comments. I believe what David is getting at is finding out for sure whether the change was intended or not. The quote from the link you provide msg += message_body appears to be the programming error, already explained in #11898, where msg is unicode and message_body is bytes with non-ascii bytes. u'a'+'\xf0' UnicodeDecodeError: 'ascii' codec can't decode byte 0xf0 in position 0: ordinal not in range(128) This is exactly the same error message that followed in the link, except that the position of the non-ascii byte. The fix is to not do the above. -- nosy: +terry.reedy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12398 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12398] Sending binary data with a POST request in httplib can cause Unicode exceptions
Changes by Terry J. Reedy tjre...@udel.edu: -- stage: - test needed type: crash - behavior versions: -Python 3.1, Python 3.2, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12398 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12303] expose sigwaitinfo() and sigtimedwait() in the signal module
STINNER Victor victor.stin...@haypocalc.com added the comment: It is possible to pass a negative timeout It now raises an exception like select. Great. According to the manual page, sigwaitinfo() or sigtimedwait() can be interrupted (EINTR) Actually, PyErr_SetFromErrno() does this implicitly. I added a test case anyway. I would prefer an explicit call to PyErr_CheckSignals(), but if there is a test, it's just fine. So I've left out si_addr (I don't think it's needed) ... and si_value (not sure what it's for or how to represent a union :-)) I don't think that it means something in Python to have an address or this low-level value field. If someone needs them, we would need an use case with an example (to test it!). (So ok to not expose them) ... si_band (we don't have SIGPOLL) What do you mean? signal.SIGPOLL exists in Python 3.3. sigtimedwait() raises a OSError(EGAIN) on timeout. It now returns None. Great. -- I will do a deeper review on the second version of your patch :-) How much more in depth can it get ;-) ? Here you have, issue12303_v2.patch: - PyStructSequence_SET_ITEM(result, 4, PyLong_FromPid(si-si_uid)); looks wrong (we don't need to call PyLong_FromLongLong): si_uid type is uid_t, not pid_t. posix_getuid() simply uses PyLong_FromLong((long)getuid()). - sigwaitinfo() doc doesn't mention that the function can be interrupted if an unexpected signal is received. I don't know if it should be mentionned. It is mentionned in the manpage, in the ERRORS section (EINTR). - tests: test_sigtimedwait_negative_timeout() doesn't need to use _wait_helper() (which creates a subprocess!). You may also test (-1, 0) and (0, -1) timeouts. - test_sigwaitinfo(), test_sigtimedwait_poll(), test_sigwaitinfo_interrupted() are called from a child process. In test_wait(), I chose to write manually to stdout and call os._exit(1) (oh, I forgot an explicit sys.stdout.flush()). I don't know if you can use TestCase methods in a child process (I don't know what is written to stdout, _wait_helper() calls os._exit). - you may want to prepare the What's new in Python 3.3 document (mention the 2 new functions) - style: _wait_helper(): you don't have to mark the helper as private (- wait_helper()) - style: _fill_siginfo() is already a static function you don't need a _ prefix -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12303 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12398] Sending binary data with a POST request in httplib can cause Unicode exceptions
Terry J. Reedy tjre...@udel.edu added the comment: Did things like u'a'+'\xf0' work in 2.6- (with implicit latin-1 decoding)? (I do not have 2.6 loaded.) The doc for seq+seq (concatenation) in the language reference section 5.6. Binary arithmetic operations says that both sequences must be the same type. In the Library manual, 5.6. Sequence Types, the footnote for seq+seq makes no mention of a special exception for (some) mixed unicode/byte concatenations. I think footnote 6 about string+string should both note the exception and its limitation (and if the limitation was changed in 2.7, say so). (In any case, the exception was removed in Py3, so *this* is not a Py3 issue.) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12398 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11457] Expose nanosecond precision from system calls
STINNER Victor victor.stin...@haypocalc.com added the comment: I suggest that rather than using composite time stamps, decimal.Decimal is used to represent high-precision time in Python. Hey, why nobody proposed datetime.datetime objects? Can't we improve the datetime precision to support nanoseconds? I would prefer to have a nice datetime object instead of a integer with an unknown reference (epoch). Or does it cost too much (cpu/memory) to create temporary datetime objects when the user just want to check for the file mode? Well, the typical usecase of a file timestamp is to check if a file has been modified (mtime greater than the previous value), or if a file is newer than other one (mtimeA mtimeB). I don't think that formating the timestamp is the most common usage of os.stat() friends. float, int tuples and Decimal are all comparable types. For timestamps arguments (e.g. signal.sigtimedwait, #12303), I would like to be able to pass a tuple (int, int) *or a float*. It is not because the function provides high precision that I need high precision. I bet that most user only need second resolution for signal.sigtimedwait for example. If you want to pass Decimal: why not, as you want :-) But we have to write a shared function to parse timestamps with a nanosecond resolution (to always accept the same types). By the way, Windows does also use timestamps with a nanosecond resolution, it's not specific to POSIX! Oh! And Python has a os.stat_float_times(False) function to change globally the behaviour of the stat functions! It remembers other bad ideas like the datetime.accept2dyear, sys.setfilesystemencoding() or sys.setdefaultencoding(). I don't like functions changing globally the behaviour of Python! -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11457 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11457] Expose nanosecond precision from system calls
Martin v. Löwis mar...@v.loewis.de added the comment: Hey, why nobody proposed datetime.datetime objects? datetime.datetime is extremely bad at representing time stamps. Don't use broken-down time if you can avoid it. By the way, Windows does also use timestamps with a nanosecond resolution, it's not specific to POSIX! Actually, it doesn't. The Windows filetime data type uses units of 100ns, starting on 1.1.1601. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11457 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11457] Expose nanosecond precision from system calls
STINNER Victor victor.stin...@haypocalc.com added the comment: datetime.datetime is extremely bad at representing time stamps. Don't use broken-down time if you can avoid it. I didn't know that datetime is extremely bad at representing time stamps, could you explain please? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11457 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com