[issue15392] Create a unittest framework for IDLE
Ezio Melotti added the comment: I wonder is there is something wrong with the repository. The repo looks ok to me. You could try to run hg verify on your machine id you want to make sure your clone is ok. I wrote about the problem on the committer's list a few days ago, but got no response yet. It probably fell thru the cracks. I've seen the mail but it's hard to tell what the problem was after the fact. Next time it happens I suggest you to come on #python-dev and ask there before continuing. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15392] Create a unittest framework for IDLE
Nick Coghlan added the comment: Just a quick note on the directory naming: idlelib/idle_test sounds like a good option to me. Putting it under idlelib makes it easy for distros to carve it out along with the rest of Idle, as well as making it clear that it falls under the purview of PEP 434 Expanding Itest - idle_test is a combination of Itest being somewhat cryptic in the first place, and then the potential for 1/I/l/i glyph confusion (depending on font) making it worse. Other than that, +1 to what Ezio said (I wouldn't worry about moving any more existing tests for this patch though - starting to move self-tests out of the individual IDLE files to the new test suite can be a good next step) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17978] Python crashes if Py_Initialize/Py_Finalize are called multiple times
Marc-Andre Lemburg added the comment: On 15.05.2013 01:28, Amaury Forgeot d'Arc wrote: Amaury Forgeot d'Arc added the comment: The official way to build without unicode is ./configure --enable-unicode=no But see issue17979. The official way to build without Unicode is: ./configure --disable-unicode See http://bugs.python.org/issue8767 for the most recent set of fixes that were supplied to make it work again in Python 2.7.4. -- nosy: +lemburg ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17978 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17979] Cannot build 2.7 with --enable-unicode=no
Marc-Andre Lemburg added the comment: Please note that the official way to build Python without Unicode support is (see http://bugs.python.org/issue445762): ./configure --disable-unicode See http://bugs.python.org/issue8767 for the most recent set of fixes that were supplied to make it work again in Python 2.7.4. If the above doesn't work, it's a bug (as well) - and has been for quite a few releases. Technically, --disable-unicode is mapped to --enable-unicode=no by configure. I guess we'd need a buildbot to check whether --disable-unicode still works, i.e. produces a Python version that compiles and passes the basic tests. -- nosy: +lemburg ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17979 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15392] Create a unittest framework for IDLE
Terry J. Reedy added the comment: Ezio, thank you for the response. 1. I care more about where the directory of tests is than what it is called. 'idle_test' or 'idletest' or whatever would be fine. Lets make that the last bikeshed item ;-). 2. I looked as #10572. It was originally about moving unittest tests from unittest/xx to test/yy, and then broadened to other packages. Michael F. gave two reasons for the move. 2A. Easier to grep without recursing into the test directory. Barry already refuted this, pointing out that grep/find have options to not recurse. The Idle equivalent, Find in Files, has a little checkbox [] Recurse down subdirectories. I think Michael had this point backwards. The advantage of having tests with the code is to make grepping both at once possible. I am sure I will want to do this while developing the tests. So add this to my list of reasons to put the directory under idlelib. 2B. Would honor the Windows Install without Tests option. This is strictly a matter of saving space by disabling function. I agree that this is appropriate for nearly all packages, but I already explained why I want to evade that option: tkinter and idle are exceptional in that they are the only two packages that people regularly have problems running. So I think people should have those tests available, even if none of the others. 2 (again). Other people opined that package maintainers should have some say in the matter and that there might be exceptions. 3. Many modules have more or useless 'sanity-check' tests run with the 'if __name__' mechanism. I think *all* of these should be replaced with unittest.main(xxx, verbosity=2, exit=False) to run the full test module. If the code module test has anything valuable that is not in the test module, it should be moved there; the rest should be deleted. I plan to eventually do this with all such 'tests' in idlelib/*.py. However, this needs to be done one by one. Some current tests have program errors; my 'file' to 'open' patch last week was the first fix. Some put up a blank window, with no indication of what a person is expected to do to perform the test. Some put up a window that will not close by normal means. All except the two in idletasks.diff require human intervention, which is not acceptible for buildbots. Question: is there a way for a test to detect being run by a buildbot? 4. I already used @template.txt to alter CallTips.py and start test_calltips.py and I want to use it for all the other 60 (or whatever) test files. I will (re)read the test-writing section and possibly suggest a patch. But Idle-specific info and code does not belong there. (5.) unittest.SkipTest is what I was looking for. I do not believe that support.import_module() will allow skipping if, or unless, the test is running on a specific platform. I need to look at #16935. Is Idle CPython only? If so, that should be a condition of test/test_idle.py running. Ah, testing the imports of tkinter and idlelib already takes care of that. (6.) My concern and possible confusion about raising exceptions came from Jayakrishnan's patch +def test_DirBrowserTreeItem(self): +# Issue16226 - make sure that getting a sublist works +d = PathBrowser.DirBrowserTreeItem('') +d.GetSubList() in relation to the doc saying Note that in order to test something, we use one of the assert*() methods provided by the TestCase base class. There is no such method. The doc follows with If the test fails, an exception will be raised, and unittest will identify the test case as a failure. Any other exceptions will be treated as errors. The 'test above is to raise, or not, an 'other exception' and I took 'treated as errors' to mean that raising an 'other exception' is an error. It certainly makes test failure counted as an error rather than an error and indistinguishable from test code errors. I guess when the test is fleshed out, there should and will be some assert about the result of d.getsublist(). So I could delete the try-except. (7.) A human-intervention resource. I will leave that for later. My next step after this one is moving tests from CallTips.py to the new test_calltips.py (3. above). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15392] Create a unittest framework for IDLE
Terry J. Reedy added the comment: For future reference, there is an idle specific issue that I do not think has been mentioned yet. Idle can run in one process, but the default mode now, and perhaps only mode sometime in the future, is two processes communicating through a socket. Testing two process communication requires two test processes, not just one. Tests will pass in one process without testing the full normal process. For instance: def fetch_tip(self, expression): try: rpcclt = self.editwin.flist.pyshell.interp.rpcclt except AttributeError: rpcclt = None if rpcclt: return rpcclt.remotecall(exec, get_the_calltip, (expression,), {}) else: return get_argspec(get_entity(expression)) I believe this works because fetch_tip executed in the idle process makes a remote call that results in fetch_tip being executed in the remote process, where self has no editwin and hence control falls through to the last line. A normal, naive test of fetch_tip will 'work' because it will simply fall through to the last line, which in this case is mostly redundant with separate tests of get_entity and get_argspec. It seems to me that a full test suite must at some point test that the actual communication works, and that this cannot all be done with mocks. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15392] Create a unittest framework for IDLE
Terry J. Reedy added the comment: Thanks Nick. Tomorrow I should change the directory name, delete try-except, commit, and move onward on the path laid out. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17979] Cannot build 2.7 with --enable-unicode=no
Serhiy Storchaka added the comment: I can't reproduce this when build with --disable-unicode. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17979 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17976] file.write doesn't raise IOError when it should
Changes by Jaakko Moisio jaakko.moi...@aalto.fi: Added file: http://bugs.python.org/file30266/fileobject-fix4.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17976 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17976] file.write doesn't raise IOError when it should
Jaakko Moisio added the comment: I tried to reply to the review of my last patch but this tracker software itself crashed. Is there anyone who would be interested in the traceback? Anyway, I'll reply here. On 2013/05/15 08:37:29, Charles-François Natali wrote: http://bugs.python.org/review/17976/diff/8158/Objects/fileobject.c File Objects/fileobject.c (right): http://bugs.python.org/review/17976/diff/8158/Objects/fileobject.c#newcode1856 Objects/fileobject.c:1856: if (n2 != n || errno != 0) { Hum, we saw that ferror() could be used to detect the error, so it should be used instead. Also, there's a problem with this patch: it's checking errno too late: for example, it could have been cleared by FILE_END_ALLOW_THREADS or Py_XDECREF in the meantime. Ok. However I must point out that if errno is cleared in the meantime, that also affects PyErr_SetFromErrno. I've submitted another patch where I'm extra careful with errno. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17976 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17979] Cannot build 2.7 with --enable-unicode=no
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17979 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17974] Migrate unittest to argparse
Michael Foord added the comment: Discovery from a module importing main doesn't make sense (although from a *script* importing main it does). So long as python -m unittest -v continues to launch discovery, and the positional argument form of discovery still works, then the new patch looks good. I'll try it out and confirm. In general I agree with Antoine, the best way to improve the implementation of unittest.main is to provide a new discovery script (with supporting code that is then much easier to extend). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17974 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17980] ssl.match_hostname() trips over crafted wildcard names
New submission from Florian Weimer: If the name in the certificate contains many * characters, matching the compiled regular expression against the host name can take a very long time. Certificate validation happens before host name checking, so I think this is a minor issue only because it can only be triggered in cooperation with a CA (which seems unlikely). The fix is to limit the number of * wildcards to a reasonable maximum (perhaps even 1). -- components: Library (Lib) messages: 189280 nosy: fweimer priority: normal severity: normal status: open title: ssl.match_hostname() trips over crafted wildcard names versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17980 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17976] file.write doesn't raise IOError when it should
Jaakko Moisio added the comment: I tried to reply to the review of my last patch but this tracker software itself crashed. Is there anyone who would be interested in the traceback? Never mind. I found the meta tracker and posted my traceback there. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17976 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17754] test_ctypes assumes LANG=C LC_ALL=C
Roundup Robot added the comment: New changeset 4f594f9b296a by doko in branch '2.7': - Issue #17754: Make ctypes.util.find_library() independent of the locale. http://hg.python.org/cpython/rev/4f594f9b296a -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17754 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17981] SysLogHandler closes connection before using it
New submission from Julien Palard: I have a script that close its socket to /dev/log immediatly before using it, causing it to fail, here is the code : {{{ #!/usr/bin/env python # -*- coding: utf-8 -*- import logging import logging.handlers import daemon from daemon.pidlockfile import PIDLockFile logger = logging.getLogger('twitterCounter') logger.addHandler(logging.handlers.SysLogHandler(address='/dev/log')) logger.setLevel(logging.DEBUG) logger.info(Hello) with daemon.DaemonContext(): logger.info(World !) }}} and here is an strace : {{{ strace -s999 -f /tmp/test.py 21 | grep -C2 ^connect // Outside daemonContext, all is OK // Note that inside daemonContext, all is OK if we do not log outside daemonContext. close(3)= 0 socket(PF_FILE, SOCK_DGRAM, 0) = 3 connect(3, {sa_family=AF_FILE, path=/dev/log}, 10) = 0 sendto(3, 14Hello\0, 10, 0, NULL, 0) = 10 getuid()= 1001 -- // Second log, inside daemonContext, with the erroneous socket(); close() : socket(PF_FILE, SOCK_DGRAM, 0) = 3 close(3)= 0 connect(3, {sa_family=AF_FILE, path=/dev/log}, 10) = -1 EBADF (Bad file descriptor) close(3)= -1 EBADF (Bad file descriptor) // As the previous try has failed, SysLogHandler seems to give another try with different parameters, failing too as expected socket type is DGRAM : socket(PF_FILE, SOCK_STREAM, 0) = 3 connect(3, {sa_family=AF_FILE, path=/dev/log}, 10) = -1 EPROTOTYPE (Protocol wrong type for socket) }}} -- components: Library (Lib) messages: 189283 nosy: Julien.Palard priority: normal severity: normal status: open title: SysLogHandler closes connection before using it type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17981 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15392] Create a unittest framework for IDLE
Ezio Melotti added the comment: Having idle_test under idlelib is fine with me if it makes your life easier. 3. Many modules have more or useless 'sanity-check' tests run with the 'if __name__' mechanism. I think *all* of these should be replaced with unittest.main(xxx, verbosity=2, exit=False) to run the full test module. If the code module test has anything valuable that is not in the test module, it should be moved there; the rest should be deleted. All the sanity checks (at least the reasonably sane) should be converted to unittest and moved from the modules to the respective test_* modules. The others should be removed, and I don't think we have to keep the if __name__ in the modules (the test modules should have it though). Specifying the verbosity=2 in all the test modules might not be a good idea. If you are running all the tests at once, that level of verbosity will just get in the way (and I'm not sure you can change it easily). If you are running individual tests modules you should be able to change the verbosity from the command line. Question: is there a way for a test to detect being run by a buildbot? You can handle this by adding a new resource to test.support. The tests will normally be skipped unless you explicitly run them using ./python -m test -uhumanneeded or you run the test file directly (you can enable the resource in the if __name__). 4. I already used @template.txt to alter CallTips.py and start test_calltips.py and I want to use it for all the other 60 (or whatever) test files. I will (re)read the test-writing section and possibly suggest a patch. As I suggested earlier, I think the main function in Lib/idlelib/CallTips.py should be converted to unittest and moved to test_calltips. CallTips.py should not include any test-related code and no if __name__ IMHO. But Idle-specific info and code does not belong there. Agreed. Actually once the initial conversion is done I don't think documenting it so important, since it will be easier to look at all the others tests and see what they do than finding the documentation that explain how things should be done. (5.) unittest.SkipTest is what I was looking for. I do not believe that support.import_module() will allow skipping if, or unless, the test is running on a specific platform. I need to look at #16935. Nope, but you can do if sys.platform() == '...': raise unittest.SkipTest(...). The TL;DR version of #16935 is that it will break test discovery on 3.3, but that's not a big problem. (6.) My concern and possible confusion about raising exceptions came from Jayakrishnan's patch Either if you get a failure or an error, it still means there's something wrong :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15267] tempfile.TemporaryFile and httplib incompatibility
Геннадий Егоров added the comment: i think it is not good, len(fd) must raise AttributeError, not TypeError -- nosy: +Геннадий.Егоров ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15267 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17754] test_ctypes assumes LANG=C LC_ALL=C
Roundup Robot added the comment: New changeset d6a43a99aea3 by doko in branch '3.3': - Issue #17754: Make ctypes.util.find_library() independent of the locale. http://hg.python.org/cpython/rev/d6a43a99aea3 New changeset 9a44f12df844 by doko in branch 'default': - Issue #17754: Make ctypes.util.find_library() independent of the locale. http://hg.python.org/cpython/rev/9a44f12df844 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17754 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17754] test_ctypes assumes LANG=C LC_ALL=C
Matthias Klose added the comment: fixed in 2.7, 3.3 and trunk -- resolution: - fixed stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17754 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17982] Syntax Error in IDLE3 not in IDLE
New submission from Hugh Littlejohn: New to Python, acquired Raspberry PI. Upgraded and now have IDLE and IDLE3. Python 3.2.3 (default, Mar 1 2013, 11:53:50) (GNU 4.6.3] on Linux2 First task, New Window to create Hello, World! Using IDLE3, created file helloworld.py Using Run/ Check Module - failed with syntax error on the closing double-quote Tried space before ending double-quote - failed Tried reducing string to Hello - failed Removed training end-of-line - failed Closed IDLE3 and started IDLE Loaded file as before - worked as expected Restarted IDLE3 - still failed Tried command-line python helloworld.py - worked as expected Any ideas ? -- components: IDLE files: helloworld.py messages: 189288 nosy: Littlejohn priority: normal severity: normal status: open title: Syntax Error in IDLE3 not in IDLE type: crash versions: Python 3.2 Added file: http://bugs.python.org/file30267/helloworld.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17982 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17982] Syntax Error in IDLE3 not in IDLE
Ned Batchelder added the comment: Python 3 has no print statement, it has a print function, so you need: print(Hello, world!) -- nosy: +nedbat ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17982 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15392] Create a unittest framework for IDLE
Terry J. Reedy added the comment: Tests have at least two very different purposes. One is test-driven development of code (and tests) by developers. The other is regression detection by buildbots. if __name__ in code modules, in addition to test modules, makes the first much easier. First, the unittest.main call in the test module must be appropriate for the buildbots. Since buildbots do not execute the corresponding call in the code module, it can and and should tuned for development, which I have done. The 'if' block is also a place for any other code specific to developer tests, such as enabling a 'humanneeded' resource. Second, when editing with Idle, F5 in an editor window runs the test in the Idle shell, where right-click, click on a traceback line takes one back to the corresponding file and line. At least on Windows, using the console and console interpreter is painful by comparison. All this is true when editing any Python file, not just Idle files, so I would be disappointed if someone went through the st dlib deleting, rather than revising the 'if __name__' blocks. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17980] ssl.match_hostname() trips over crafted wildcard names
Antoine Pitrou added the comment: Does the RFC say anything about this? How much wildcards are necessary to take up a significant amount of CPU time? -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17980 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16748] Make CPython test package discoverable
Terry J. Reedy added the comment: Chris: import unittest as u; u.main(test.test_xxx) Ezio: I think that's the last nail in the coffin of test_main. Terry, do you agree? Belated answer: now that I use and understand the idiom, yes. Chris: The load_tests protocol (2.7, 3.2+) seems like the right approach for [tests in directories outside of /test]. I am using that in the new idlelib/idle_test/__init__.py. But perhaps the load_tests() example in the doc, which I copied, should be changed from 'do nothing' to 'discover all tests in the directory' as a more useful default. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16748 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17983] global __class__ statement in class declaration
New submission from Dwight Guth: The following python program causes cpython to crash: class A: global __class__ def a(self): super() I get the following output on the console: bug.py:2: SyntaxWarning: name '__class__' is assigned to before global declaration global __class__ lookup '__class__' in � a sequ 2 -1 freevars of A: ('__class__',) Fatal Python error: compiler_make_closure() Current thread 0x7fc712192700: Aborted (core dumped) This probably happens because __class__ is handled specially by the scoping rules and isn't expected to be anything other than a member of co_cellvars. It should probably throw an exception instead (SystemError?) -- messages: 189293 nosy: dwight.guth priority: normal severity: normal status: open title: global __class__ statement in class declaration type: crash versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17983 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17983] global __class__ statement in class declaration
Changes by Benjamin Peterson benja...@python.org: -- assignee: - benjamin.peterson nosy: +benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17983 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13146] Writing a pyc file is not atomic
Changes by Barry A. Warsaw ba...@python.org: -- nosy: +barry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13146 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17974] Migrate unittest to argparse
Serhiy Storchaka added the comment: Here is other variant of patch, even less horrible. However it introduces some incompatibility: 1. Discovery mode now works only when module==None (i.e. from -m unittest). It is only case for which it was documented. 2. Previously unittest.main(failfast=False, argv=['prog', '-f']) caused an error, while unittest.main(failfast=True, argv=['prog', '-f']) and unittest.main(failfast=[], argv=['prog', '-f']) just had no any effect. Now all non-None casse cause an error. The same for catchbreak and buffer. -- Added file: http://bugs.python.org/file30268/unittest_argparse_less_horrible_3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17974 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8604] Adding an atomic FS write API
Changes by Barry A. Warsaw ba...@python.org: -- nosy: +barry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8604 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17984] io and _pyio modules require the _io module
New submission from Serhiy Storchaka: io and _pyio modules don't usable without the _io module. In particular when 2.7 build without unicode. Why we have a Python implementation if it can't be used as a fallback when a C implementation is not available? -- components: IO messages: 189295 nosy: benjamin.peterson, hynek, pitrou, serhiy.storchaka, stutzbach priority: normal severity: normal status: open title: io and _pyio modules require the _io module type: behavior versions: Python 2.7, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17984 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17984] io and _pyio modules require the _io module
Benjamin Peterson added the comment: Well, we at least need some C level _fileio. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17984 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17984] io and _pyio modules require the _io module
Benjamin Peterson added the comment: Patches welcome, of course! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17984 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17984] io and _pyio modules require the _io module
Alex Gaynor added the comment: I don't see why we need some C level _fileio, the os module has everythign we need. -- nosy: +alex ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17984 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12370] Use of super overwrites use of __class__ in class namespace
Roundup Robot added the comment: New changeset 3d858f1eef54 by Benjamin Peterson in branch 'default': hide the __class__ closure from the class body (#12370) http://hg.python.org/cpython/rev/3d858f1eef54 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12370 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12370] Use of super overwrites use of __class__ in class namespace
Benjamin Peterson added the comment: Finally killed this one properly. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12370 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17971] Weird interaction between Komodo Python debugger C module Python 3
Eric Promislow added the comment: I found a workaround in our debugger code, so you can lower the priority on this, or even mark it Wontfix, although I still think the frame stack is getting messed up. One thing about our debugger, it essentially runs all the Python code in a big exec statement, and this particular code contains its own exec stmt. The stack looks wrong after we finish the inner exec statement. So if you're looking for a repro, that might be the way to go. However I can break at line 10 in the following code with no problem using pdb (Py 3): 1 #!/usr/bin/env python3 2 3 def inner_f(a, b): 4 ns2 = {c: 7, a:a, b:b, tot:None } 5 exec(tot = a + b + 1 + 100 * c, ns2) 6 return ns2['tot'] 7 8 ns1 = {c: 5, inner_f: inner_f, res:None } 9 exec(res = inner_f(3, 4) + 10 * c, ns1) 10 print(After all that, res: %d % (ns1['res'],)) 11 print(Stop here) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17985] multiprocessing Queue.qsize() and Queue.empty() with different results
New submission from Andre Dias: The problem is that Queue.empty() is True even if Queue.qsize()0! #!/usr/bin/python from multiprocessing import Queue numbers=Queue() for i in range (0,10): numbers.put(i) if numbers.qsize()0 and numbers.empty(): print BUG?! -- components: Extension Modules messages: 189302 nosy: aod priority: normal severity: normal status: open title: multiprocessing Queue.qsize() and Queue.empty() with different results versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17985 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17982] Syntax Error in IDLE3 not in IDLE
Terry J. Reedy added the comment: Please ask questions like this on python-list, mirrored as newsgroup gmane.comp.python.general or on other forums. This tracker is for patching Python itself, not usage questions. -- nosy: +terry.reedy resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17982 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17981] SysLogHandler closes connection before using it
Changes by Terry J. Reedy tjre...@udel.edu: -- nosy: +vinay.sajip ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17981 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17986] Alternative async subprocesses (pep 3145)
New submission from Richard Oudkerk: In the attached file is an experimental implementation of an AsyncPopen class. It should work for Python 3.3, 3.4 on Unix and Windows. Unlike http://code.google.com/p/subprocdev (see #1191964) this does not depend on using time.sleep() and polling. It also uses the stdlib's _winapi instead of ctypes. It lets one do Unix-style multiplexing of stdin, stdout, stderr on Windows (by using overlapped IO). Differences from normal Popen: * File objects created for stdin/stdout/stderr using ...=PIPE are non-blocking. * There are no options for buffering or for universal line endings (or unicode). * There is an extra method select(file_list, timeout=None) - ready_file_list which can be used to wait for stdin, stdout, stderr to be ready. file_list should be a sublist of [self.stdin, self.stdout, self.stderr] with no None elements. Note that there is no separation between readers and writers the way there is for the normal select() function. On Unix this is implemented using select() or poll(). * On Windows close() can fail with BlockingIOError. To prevent this one must use select() to wait for self.stdin to be ready. As an example, communicate() can be reimplemented using select() as follows: def communicate(p, input): buf = memoryview(input) collected = collections.defaultdict(list) registered = [f for f in (p.stdin, p.stdout, p.stderr) if f is not None] while registered: for f in p.select(registered): if f is p.stdin: if not buf: f.close() registered.remove(f) else: n = f.write(buf) if n is not None: buf = buf[n:] elif f in (p.stdout, p.stderr): s = f.read(8192) if s == b'': f.close() registered.remove(f) elif s is not None: collected[f].append(s) else: raise RuntimeError('should not get here') return (b''.join(collected[p.stdout]) if p.stdout else None, b''.join(collected[p.stderr]) if p.stderr else None) -- files: asyncsubprocess.py messages: 189304 nosy: sbt priority: normal severity: normal status: open title: Alternative async subprocesses (pep 3145) versions: Python 3.4 Added file: http://bugs.python.org/file30269/asyncsubprocess.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17986 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17985] multiprocessing Queue.qsize() and Queue.empty() with different results
Richard Oudkerk added the comment: From the docs: qsize() Return the approximate size of the queue. Because of multithreading/multiprocessing semantics, this number is not reliable. Adding a short sleep before calling qsize() and empty() should make things appear to work. But really, there are no good reasons for using qsize() except for debugging. The same applies to queue.Queue. -- nosy: +sbt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17985 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17983] global __class__ statement in class declaration
Roundup Robot added the comment: New changeset cd9141a4f999 by Benjamin Peterson in branch '3.3': complain about global __class__ in a class body (closes #17983) http://hg.python.org/cpython/rev/cd9141a4f999 -- nosy: +python-dev resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17983 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17971] Weird interaction between Komodo Python debugger C module Python 3
Benjamin Peterson added the comment: If you ever find a Python bug, feel free to reopen. -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17972] inspect module docs omits many functions
Terry J. Reedy added the comment: I do not know what you mean by 'leak docs' so I changed the title to something that makes more sense. It is possible that these functions are considered private to the module, but then their names should be preceded by '_', or else there should be an '__all__' list that omits them. So the omission may be a mistake. I do not know. -- nosy: +terry.reedy stage: - needs patch title: inspect module leak docs - inspect module docs omits many functions ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17972 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17985] multiprocessing Queue.qsize() and Queue.empty() with different results
Andre Dias added the comment: But qsize() is working. what is not working is empty() 2013/5/15 Richard Oudkerk rep...@bugs.python.org Richard Oudkerk added the comment: From the docs: qsize() Return the approximate size of the queue. Because of multithreading/multiprocessing semantics, this number is not reliable. Adding a short sleep before calling qsize() and empty() should make things appear to work. But really, there are no good reasons for using qsize() except for debugging. The same applies to queue.Queue. -- nosy: +sbt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17985 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17985 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17967] urllib2.open failed to access a url when a perent directory of the url is permission denied
Terry J. Reedy added the comment: Did you run the urllib test module after your code change? Have you tried 3.3? -- nosy: +orsenthil, terry.reedy stage: - test needed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17967 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17987] test.support.captured_stderr, captured_stdin not documented
New submission from Fred L. Drake, Jr.: The captured_stderr and captured_stdin context managers aren't documented, and should be. -- assignee: docs@python components: Documentation keywords: easy messages: 189311 nosy: docs@python, fdrake priority: normal severity: normal stage: needs patch status: open title: test.support.captured_stderr, captured_stdin not documented type: enhancement versions: Python 3.3, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17987 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17965] argparse does not dest.replace('-', '_') for positionals
Changes by Terry J. Reedy tjre...@udel.edu: -- nosy: +bethard ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17965 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17981] SysLogHandler closes connection before using it
Changes by Josh Purvis joshua.pur...@gmail.com: -- nosy: +Josh.Purvis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17981 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17953] sys.modules cannot be reassigned
Terry J. Reedy added the comment: sys.modules This is a dictionary that maps module names to modules which have already been loaded. This can be manipulated to force reloading of modules and other tricks. How about adding at the end However, replacing or clearing it may cause Python to fail. or to be slightly more explicit However, replacing it or deleting critical entries may cause Python to fail. -- nosy: +terry.reedy stage: test needed - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17953 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15392] Create a unittest framework for IDLE
Nick Coghlan added the comment: Terry, the unittest and regrtest command lines are *built* for TDD - you rely on test discovery and selection to run the appropriate tests for what you're working on. However, the point about F5 in IDLE is well made, and a reasonable rationale for ensuring at least the IDLE implementation files support running their tests that way. While it doesn't need to be extensive, it would be good to capture some of these points in a Idle/idle_tests/README file. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17979] Cannot build 2.7 with --enable-unicode=no
Amaury Forgeot d'Arc added the comment: Can't build here with after ./configure --disable-unicode. Serhiy, which OS did you try? I'm running Debian 64bit, with gcc 4.6.3 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17979 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17985] multiprocessing Queue.qsize() and Queue.empty() with different results
Richard Oudkerk added the comment: On 15/05/2013 10:25pm, Andre Dias wrote: But qsize() is working. what is not working is empty() empty() returns False when there is data in the underlying pipe. But the data does not enter the pipe until a background thread has written it to the pipe. This should not cause any problems. Using Queue.empty() is always subject to races. It is just that the multiprocessing version has an additional type of race compared to the normal one. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17985 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17962] Broken OpenSSL version in Windows builds
Martin v. Löwis added the comment: I have now updated the code. Yogesh: It is somewhat more that just committing the source; the assembler files need to be generated. The objective is to not require Perl on the build machines. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17962 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17985] multiprocessing Queue.qsize() and Queue.empty() with different results
Andre Dias added the comment: RIchard, But the example program has no races, no threads, nothing. empty() is returning TRUE even though qsize() is 0 (which actually is) And it happens almost every time I run that small example. I had read the module doc, and I know its an unreliable method, but man, the example program is too simple to fail Truth is I decided qsize() is more reliable and im using it in my programs, but man empty() problem is so ridiculous that I decided to submit here 2013/5/15 Richard Oudkerk rep...@bugs.python.org Richard Oudkerk added the comment: On 15/05/2013 10:25pm, Andre Dias wrote: But qsize() is working. what is not working is empty() empty() returns False when there is data in the underlying pipe. But the data does not enter the pipe until a background thread has written it to the pipe. This should not cause any problems. Using Queue.empty() is always subject to races. It is just that the multiprocessing version has an additional type of race compared to the normal one. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17985 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17985 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17953] sys.modules cannot be reassigned
Brett Cannon added the comment: Sounds good to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17953 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17986] Alternative async subprocesses (pep 3145)
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +neologix ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17986 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17988] ElementTree.Element != ElementTree._ElementInterface
New submission from Jakub Wilk: The xml.etree.ElementTree module provides _Element and _ElementInterface as compatibility aliases for Element. However, in Python 3.3 if the _elementtree module is importable, these classes are not identical: Element is a C implementation, and _Element/_ElementInterface is a Python implementation. $ python3.2 test-elementinterface.py 141477524 141477524 141477524 $ python3.3 test-elementinterface.py 137248544 4144597188 4144597188 -- components: Library (Lib) files: test-elementinterface.py messages: 189319 nosy: jwilk priority: normal severity: normal status: open title: ElementTree.Element != ElementTree._ElementInterface versions: Python 3.3 Added file: http://bugs.python.org/file30270/test-elementinterface.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17988 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17988] ElementTree.Element != ElementTree._ElementInterface
Jakub Wilk added the comment: The attached (untested) patch should fix the bug. -- keywords: +patch Added file: http://bugs.python.org/file30271/elementinterface.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17988 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17985] multiprocessing Queue.qsize() and Queue.empty() with different results
Richard Oudkerk added the comment: On 15/05/2013 11:33pm, Andre Dias wrote: But the example program has no races, no threads, nothing. empty() is returning TRUE even though qsize() is 0 (which actually is) And it happens almost every time I run that small example. I had read the module doc, and I know its an unreliable method, but man, the example program is too simple to fail Truth is I decided qsize() is more reliable and im using it in my programs, but man empty() problem is so ridiculous that I decided to submit here If you assume everything is single-threaded then you would assume that this is too simple to fail. But there *is* more than thread involved. empty() and qsize() are basically redundant. You would almost certainly be better off using get_noblock()/put_noblock() and catching Empty/Full. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17985 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17988] ElementTree.Element != ElementTree._ElementInterface
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +eli.bendersky stage: - patch review type: - behavior versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17988 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17989] ElementTree.Element broken attribute setting
New submission from Jakub Wilk: Setting attributes on ElementTree.Element objects is broken: it succeeds without exception, but then the following statement fails with AttributeError (unless that statement sets an Element's attribute too): $ python3.3 test-element-setattr.py Hello world!Traceback (most recent call last): File test-element-setattr.py, line 6, in module print('Hello world!') AttributeError: ham2 -- components: Library (Lib) files: test-element-setattr.py messages: 189321 nosy: jwilk priority: normal severity: normal status: open title: ElementTree.Element broken attribute setting versions: Python 3.3 Added file: http://bugs.python.org/file30272/test-element-setattr.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17989 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17981] SysLogHandler closes connection before using it
Vinay Sajip added the comment: Isn't this a case of handles being closed in the child after a fork, by the daemon module? Have you investigated the files_preserve option in DaemonContext? -- resolution: - invalid status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17981 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13146] Writing a pyc file is not atomic
Changes by Christian Heimes li...@cheimes.de: -- nosy: +christian.heimes ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13146 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8604] Adding an atomic FS write API
STINNER Victor added the comment: Here is a patch based on the new os.replace() function. I only tested the patch on Linux. My patch must be tested on Windows, I don't know what happens when the file object is closed when the NamedTemporaryFile.delete attribute is set to False. Does close() raise an exception? I hesitate between prefix and dir parameters for NamedTemporaryFile. If prefix is equal to filename, is it possible for NamedTemporaryFile to create a file called filename? Or does it always add a suffix? If the program crashs before rename, I prefer to leave file.XXX temporary files (ex: file.tmp, file.tmp.2, ...) instead of random names like tmpXXX. It is important to create the temporary file in the same directory to not create a file on a different file system. os.replace() fails on POSIX if the source and the destination are on two different file systems. If importing tempfile in shutil is a problem, it may be done in atomic_write() (maybe using a global variable to ensure that the module is only imported once). -- First, I tried to handle the temporary file manually (without the tempfile module) with a constant suffix. I only created a temporary file if the creation of the file (in exclusive mode, using x mode) failed. But Antoine pointed me on IRC that the function is not atomic because the file may be invalid before the file content is completly written and flushed. If two threads try to create the same file, the second thread gets a FileExistsError. In this case, the caller has to handle FileExistsError. The caller may remove the temporary file of the first thread, which may make the situation even worse. I prefer to use tempfile.NamedTemporaryFile because it is portable and well tested. It also uses a random suffix. On Windows, the O_TEMPORARY flag is passed to os.open(), so the file is removed by the OS when the file is closed, or when the program does crash. -- keywords: +patch Added file: http://bugs.python.org/file30273/atomic_write.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8604 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8604] Adding an atomic FS write API
STINNER Victor added the comment: + # Flush Python buffers to system buffers + fileobj.flush() + + if hasattr(os, 'fsync'): + # Flush system buffers to disk + fd = fileobj.fileno() + os.fsync(fd) A fsync=True paramater may be added if calling os.fsync() is an issue. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8604 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17981] SysLogHandler closes connection before using it
Josh Purvis added the comment: Ironically, I ran into this same exact issue today, and I have investigated the `files_preserve` param, with no luck. I'm not too familiar with the internals here, but from what I can tell it works with FileHandler, but not the SysLogHandler. If you try to add the syslog handler to the files_preserve list it has no effect. It seems to need a stream, and SysLogHandler doesn't have the stream attribute. # This works for FileHandler's log = logging.getLogger('MyLog') fh = logging.FileHandler('/some/file') with daemon.DaemonContext(files_preserve=[fh.stream, ]): log.warn(In the belly of the beast.) -- status: pending - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17981 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17990] 2.7 builds can fail due to unconditional inclusion of include paths
New submission from Ned Deily: For Issue17086, 8ee6d96a1019 backported some cross-build patches to the 2.7 branch. The changes to setup.py detect_modules differ in the backport from those in default. In particular, in default, changes to the library and include directory lists used to build extensions modules are only made conditionally when cross-compiling. But the 2.7 backport makes these changes unconditionally. default: def detect_modules(self): # Ensure that /usr/local is always used, but the local build # directories (i.e. '.' and 'Include') must be first. See issue # 10520. if not cross_compiling: add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') # only change this for cross builds for 3.3, issues on Mageia if cross_compiling: self.add_gcc_paths() self.add_multiarch_paths() 2.7: def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') self.add_gcc_paths() self.add_multiarch_paths() This breaks certain universal build combinations on OS X when using SDKs and it is possible it could break builds on other platforms as well. Substituting the default branch code on 2.7 appears to solve the OS X build problem. Whether it has any negative impact on other builds, in particular cross-compilations is untested. -- components: Build messages: 189327 nosy: benjamin.peterson, doko, ned.deily priority: release blocker severity: normal stage: patch review status: open title: 2.7 builds can fail due to unconditional inclusion of include paths versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17990 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17990] 2.7 builds can fail due to unconditional inclusion of include paths
Changes by Ned Deily n...@acm.org: -- keywords: +patch Added file: http://bugs.python.org/file30274/issue17990.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17990 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17990] 2.7 builds can fail due to unconditional inclusion of include paths
Matthias Klose added the comment: I don't see how this would break the cross builds, so please go ahead with this change. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17990 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8604] Adding an atomic FS write API
STINNER Victor added the comment: I prefer to use tempfile.NamedTemporaryFile because it is portable and well tested. It also uses a random suffix. On Windows, the O_TEMPORARY flag is passed to os.open(), ... Oh, and it sets also the close-on-exec safe, which is also more secure. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8604 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8604] Adding an atomic FS write API
STINNER Victor added the comment: atomic_write.patch calls os.replace(src, dst) whereas the src file is open. It works on Linux, but it sounds a little bit strange to me and may fail on other platforms. Here is another patch (atomic_write_mkstemp.patch) using tempfile.mkstemp() instead of tempfile.NamedTemporaryFile(delete=True) to control when the file is closed and removed. -- Added file: http://bugs.python.org/file30275/atomic_write_mkstemp.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8604 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11877] Change os.fsync() to support physical backing store syncs
STINNER Victor added the comment: What is the status of this issue? This issue is interesting in the implementation of #8604 (add shutil.atomic_write()). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11877 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8604] Adding an atomic FS write API
STINNER Victor added the comment: Here's the part of the code that does the open/close part: http://bazaar.launchpad.net/~exabyte/blackherd/async-refactor/view/61/blackherd/misc.py#L498 This code contains a bug: hasattr('os', 'fsync') is never True :-) This part is interesting: # fsync on Mac OS X doesn't work, it requires using the # F_FULLSYNC fcntl if hasattr(fcntl, 'F_FULLFSYNC'): fcntl.fcntl(self._fd, fcntl.F_FULLFSYNC) = see also #11877 http://trac.edgewall.org/browser/trunk/trac/util/__init__.py?#L145 This class copies file owner, permissions, flags, etc. atomic_write() should probably also call copystat() on the temporary file. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8604 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8604] Adding an atomic FS write API
Nick Coghlan added the comment: We have one of these in Beaker (we didn't need to wait for os.replace, since Beaker only runs on Linux): http://git.beaker-project.org/cgit/beaker/tree/Common/bkr/common/helpers.py?h=develop#n90 It turns out to be beneficial to separate the three operations in order to cooperate more cleanly with other operations on the same file system (in our case, we needed to be able to write data uploaded over a network connection to the temporary file *before* acquiring an flock when we did the rename). We also create the file adjacent to the destination, as creating it under the /tmp heirarchy and then renaming it is invalid under SELinux (since the security context ends up being incorrect). While Beaker is GPLv2, I'd easily be able to get permission to extract this and contribute it to the PSF. Incidentally, I'm thinking tempfile might actually be a more sensible home for this than shutil. -- assignee: tarek - ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8604 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8604] Adding an atomic FS write API
Nick Coghlan added the comment: (Note that the Beaker version would need to be enhanced with the extra API parameters from Victor's version, as well as updated to use the exclusive open and close-on-exec flags) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8604 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17990] 2.7 builds can fail due to unconditional inclusion of include paths
Roundup Robot added the comment: New changeset cd577c328886 by Ned Deily in branch '2.7': Issue #17990: Only modify include and library search paths when cross-compiling. http://hg.python.org/cpython/rev/cd577c328886 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17990 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17990] 2.7 builds can fail due to unconditional inclusion of include paths
Ned Deily added the comment: Applied to 2.7 branch. Leaving the issue open for release manager action for 2.7.5. -- components: +Cross-Build resolution: - fixed stage: patch review - committed/rejected ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17990 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17972] inspect module docs omits many functions
xiaobing jiang added the comment: when I read the memory_profiler source code, I find it using inspect.getblock(). so I check the doc, but can't find the function's doc. these functions are found not in doc. I want to known which function should in doc or not? in inspect module has no __all__ variable. sorry for poor english! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17972 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17991] ctypes.c_char gives a misleading error when passed a one-character unicode string
New submission from Steven Barker: While investigating a Stack Overflow question (http://stackoverflow.com/questions/16484764/multiprocessing-value-clear-syntax) I came across a misleading error message from the multiprocessing.Value constructor: import multiprocessing my_char = x v = multiprocessing.Value(c, my_char) Traceback (most recent call last): File pyshell#21, line 1, in module v = multiprocessing.Value(c, my_char) File S:\Python33\lib\multiprocessing\__init__.py, line 243, in Value return Value(typecode_or_type, *args, lock=lock) File S:\Python33\lib\multiprocessing\sharedctypes.py, line 70, in Value obj = RawValue(typecode_or_type, *args) File S:\Python33\lib\multiprocessing\sharedctypes.py, line 47, in RawValue obj.__init__(*args) TypeError: one character string expected The one character string expected message was rather unhelpful, since that seemed to be what I gave it. After being stumped by this for a bit, I realized that it might be having an issue with Unicode and giving an error message more appropriate to Python 2 than Python 3. Sure enough, passing a one-character bytes instance works just fine. So, at a minimum I think the error message should be updated to say it wants a one-character bytes instance rather than a string (which to my mind means a str instance). A further enhancement might be to accept unicode strings that contain just a single ASCII character too, but I realize that may be more messy and error prone. The error message comes from the ctypes module, and can be reproduced easily: ctypes.c_char(x) Traceback (most recent call last): File pyshell#28, line 1, in module ctypes.c_char(x) TypeError: one character string expected The exception text comes from Modules/_ctypes/cfield.c:1151 -- components: Library (Lib) messages: 189338 nosy: Steven.Barker priority: normal severity: normal status: open title: ctypes.c_char gives a misleading error when passed a one-character unicode string type: enhancement versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17991 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17991] ctypes.c_char gives a misleading error when passed a one-character unicode string
Changes by Steven Barker blckkn...@gmail.com: -- components: +ctypes -Library (Lib) ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17991 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15392] Create a unittest framework for IDLE
Terry J. Reedy added the comment: New patch: I renamed Itest to idle_test everywhere and re-ran tests; removed try-except from test_pathbrowser.py; and renamed @template to @README and rewrote. It applies cleanly to 3.4 on my system. The only problem applying to 2.7 is CallTips.py, which has different test code at the end. That will be easily fixed. -- Added file: http://bugs.python.org/file30276/idletest2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17992] test_asynchat hangs
Changes by Brian Curtin br...@python.org: -- type: compile error - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17992 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17992] test_asynchat hangs
New submission from Carlos Nepomuceno: after running 'make' i entered 'make test' and it hanged on test_asynchat. stayed there for more than 1 hour. --- Python build finished, but the necessary bits to build these modules were not found: _bsddb _tkinter bsddb185 bz2dbmdl gdbm imageopreadline sunaudiodev To find the necessary bits, look in setup.py in detect_modules() for the module's name. running build_scripts ./python -E -c 'import sys ; from sysconfig import get_platform ; print get_platform()+-+sys.version[0:3]' platform find ./Lib -name '*.py[co]' -print | xargs rm -f ./python -Wd -3 -E -tt ./Lib/test/regrtest.py -l == CPython 2.7.5 (default, May 16 2013, 00:43:33) [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] == Linux-2.6.32-279.19.1.el6.x86_64-x86_64-with-centos-6.4-Final little-endian == /usr/src/Python-2.7.5/build/test_python_26106 Testing with flags: sys.flags(debug=0, py3k_warning=1, division_warning=1, division_new=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=1, tabcheck=2, verbose=0, unicode=0, bytes_warning=0, hash_randomization=0) test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest /usr/src/Python-2.7.5/Lib/unittest/runner.py:39: DeprecationWarning: comparing unequal types not supported in 3.x self.showAll = verbosity 1 test_doctest test_doctest2 test_MimeWriter test_SimpleHTTPServer test_StringIO test___all__ test___future__ test__locale test__osx_support test_abc test_abstract_numbers test_aepack test_aepack skipped -- No module named aetypes test_aifc test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named MacOS test_argparse test_array test_ascii_formatd test_ast test_asynchat -- components: Tests files: test_asynchat.txt messages: 189340 nosy: Carlos.Nepomuceno priority: normal severity: normal status: open title: test_asynchat hangs type: compile error versions: Python 2.7 Added file: http://bugs.python.org/file30277/test_asynchat.txt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17992 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17992] test_asynchat hangs
Changes by Carlos Nepomuceno nepomucenocarlo...@gmail.com: Removed file: http://bugs.python.org/file30278/test_asynchat.txt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17992 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17992] test_asynchat hangs
Changes by Carlos Nepomuceno nepomucenocarlo...@gmail.com: Removed file: http://bugs.python.org/file30277/test_asynchat.txt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17992 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17992] test_asynchat hangs
Changes by Carlos Nepomuceno nepomucenocarlo...@gmail.com: Added file: http://bugs.python.org/file30278/test_asynchat.txt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17992 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17992] test_asynchat hangs
Changes by Carlos Nepomuceno nepomucenocarlo...@gmail.com: Added file: http://bugs.python.org/file30279/test_asynchat.txt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17992 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17990] 2.7 builds can fail due to unconditional inclusion of include paths
Benjamin Peterson added the comment: The 32-bit OSX binary was patched manually. -- components: -Cross-Build stage: committed/rejected - patch review status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17990 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17990] 2.7 builds can fail due to unconditional inclusion of include paths
Changes by Benjamin Peterson benja...@python.org: -- components: +Cross-Build ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17990 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com