[issue18799] Resurrect and fix test_404 in Lib/test/test_xmlrpc.py
Vajrasky Kok added the comment: Serhiy, okay, I'll create a pull request soon (in 2-3 days). -- ___ Python tracker <https://bugs.python.org/issue18799> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35519] Can not run test without test module for tests which import random module
New submission from Vajrasky Kok : $ git clone g...@github.com:python/cpython.git cpython2 $ cd cpython2 $ ./configure --with-pydebug $ make -j $ ./python Lib/test/test_xmlrpc.py Traceback (most recent call last): File "Lib/test/test_xmlrpc.py", line 8, in import xmlrpc.client as xmlrpclib File "/opt/Code/python/cpython2/Lib/xmlrpc/client.py", line 136, in import http.client File "/opt/Code/python/cpython2/Lib/http/client.py", line 71, in import email.parser File "/opt/Code/python/cpython2/Lib/email/parser.py", line 12, in from email.feedparser import FeedParser, BytesFeedParser File "/opt/Code/python/cpython2/Lib/email/feedparser.py", line 27, in from email._policybase import compat32 File "/opt/Code/python/cpython2/Lib/email/_policybase.py", line 9, in from email.utils import _has_surrogates File "/opt/Code/python/cpython2/Lib/email/utils.py", line 28, in import random File "/opt/Code/python/cpython2/Lib/random.py", line 47, in import bisect as _bisect File "/opt/Code/python/cpython2/Lib/test/bisect.py", line 27, in import tempfile File "/opt/Code/python/cpython2/Lib/tempfile.py", line 45, in from random import Random as _Random ImportError: cannot import name 'Random' from 'random' (/opt/Code/python/cpython2/Lib/random.py) I know about running test this way: $ ./python -m test -v test_xmlrpc And it works. I am just wondering whether I should be able to run test this way: ./python Lib/test/test_blabla.py? Because running other tests without test module works, for example: ./python Lib/test/test_ast.py. Only test which imports random module fails. -- components: Tests messages: 331992 nosy: vajrasky priority: normal severity: normal status: open title: Can not run test without test module for tests which import random module versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue35519> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35519] [2.7] Can not run test without test module for tests which import random module
Vajrasky Kok added the comment: Okay, thanks, Victor. Your suggestion to rename Lib/test/bisect.py to Lib/test/bisect_cmd.py works. My question is why you fixed in 2.7 branch only? This problem persists in master (3.8). Ah, I think because I use cpython2 directory name, you thought I used Python 2. cpython2 is just a directory name. It has nothing to do with Python 2. I used master when finding this bug. -- ___ Python tracker <https://bugs.python.org/issue35519> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18799] Resurrect and fix test_404 in Lib/test/test_xmlrpc.py
Change by Vajrasky Kok : -- pull_requests: +10435 ___ Python tracker <https://bugs.python.org/issue18799> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19974] tarfile doesn't overwrite symlink by directory
Vajrasky Kok added the comment: Martin Panter, thank you for reviewing my patch. Let me rework it. It has been a while (4 years!!!). -- ___ Python tracker <https://bugs.python.org/issue19974> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19974] tarfile doesn't overwrite symlink by directory
Change by Vajrasky Kok : -- pull_requests: +10895 stage: needs patch -> patch review ___ Python tracker <https://bugs.python.org/issue19974> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19974] tarfile doesn't overwrite symlink by directory
Change by Vajrasky Kok : -- pull_requests: +10895, 10896, 10898 stage: needs patch -> patch review ___ Python tracker <https://bugs.python.org/issue19974> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19974] tarfile doesn't overwrite symlink by directory
Change by Vajrasky Kok : -- pull_requests: +10895, 10896 stage: needs patch -> patch review ___ Python tracker <https://bugs.python.org/issue19974> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19974] tarfile doesn't overwrite symlink by directory
Change by Vajrasky Kok : -- pull_requests: +10895, 10896, 10897, 10898 stage: needs patch -> patch review ___ Python tracker <https://bugs.python.org/issue19974> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19974] tarfile doesn't overwrite symlink by directory
Vajrasky Kok added the comment: Martin Panter, I have modernized the patch. About your suggestion: 1. "import errno" -> Yes, this is unnecessary. I have removed it. 2. Use os.path.lexists instead of os.path.islink for broken symlink -> The thing is os.path.islink returns True also for broken symlink. I could not find a case where these methods return different result. -- ___ Python tracker <https://bugs.python.org/issue19974> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19974] tarfile doesn't overwrite symlink by directory
Vajrasky Kok added the comment: "I could not find a case where these methods return different result." -> This is wrong. My mistake. os.lexists returns True for non symbolic link file while os.islink returns False. -- ___ Python tracker <https://bugs.python.org/issue19974> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19974] tarfile doesn't overwrite symlink by directory
Vajrasky Kok added the comment: Sorry, Martin. I just understood what you suggested. I thought you were saying lexists to replace islink, but it is to replace the complex if condition. Let me work on it. -- ___ Python tracker <https://bugs.python.org/issue19974> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19974] tarfile doesn't overwrite symlink by directory
Vajrasky Kok added the comment: After experimenting with lexists, I don't think I can simplify it with lexists. -- ___ Python tracker <https://bugs.python.org/issue19974> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19974] tarfile doesn't overwrite symlink by directory
Vajrasky Kok added the comment: I have added test case for broken symlinks. I am not sure whether this is necessary or not. But anyway I have added it. -- ___ Python tracker <https://bugs.python.org/issue19974> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19974] tarfile doesn't overwrite symlink by directory
Vajrasky Kok added the comment: Martin, thank you for your advice. I have added additional two test cases for broken symlink case. 1. broken symlink overwrites ordinary file, 2. ordinary file overwrites broken symlink. I hope that is enough. Let me know if you have another concern. -- ___ Python tracker <https://bugs.python.org/issue19974> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19974] tarfile doesn't overwrite symlink by directory
Vajrasky Kok added the comment: Correction: 1. broken symlink overwrites valid symlink, 2. ordinary file overwrites broken symlink. -- ___ Python tracker <https://bugs.python.org/issue19974> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19791] test_pathlib should use can_symlink or skip_unless_symlink from test.support
Vajrasky Kok added the comment: Okay, Serhiy. I'll create a pull request. -- ___ Python tracker <http://bugs.python.org/issue19791> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19791] test_pathlib should use can_symlink or skip_unless_symlink from test.support
Vajrasky Kok added the comment: Okay, this is the pull request: https://github.com/python/cpython/pull/822 -- ___ Python tracker <http://bugs.python.org/issue19791> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18106] There are unused variables in Lib/test/test_collections.py
New submission from Vajrasky Kok: In two "test_copying" methods in Lib/test/test_collections.py, variable i is never used. My guess is the original test writer forgot to utilize the variable i. For example, in test_copying method in TestOrderedDict class: def test_copying(self): # Check that ordered dicts are copyable, deepcopyable, picklable, # and have a repr/eval round-trip pairs = [('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)] od = OrderedDict(pairs) update_test = OrderedDict() update_test.update(od) for i, dup in enumerate([ od.copy(), copy.copy(od), copy.deepcopy(od), pickle.loads(pickle.dumps(od, 0)), pickle.loads(pickle.dumps(od, 1)), pickle.loads(pickle.dumps(od, 2)), pickle.loads(pickle.dumps(od, 3)), pickle.loads(pickle.dumps(od, -1)), eval(repr(od)), update_test, OrderedDict(od), ]): self.assertTrue(dup is not od) self.assertEqual(dup, od) self.assertEqual(list(dup.items()), list(od.items())) self.assertEqual(len(dup), len(od)) self.assertEqual(type(dup), type(od)) The variable i in "for i, dup in enumerate" is never used. The test_copying method in TestCounter class has the same problem. In my opinion, we need to put variable i inside the message in the assert functions to detect which place inside the iteration the test fails. -- components: Tests files: test_copying.patch keywords: patch messages: 190393 nosy: vajrasky priority: normal severity: normal status: open title: There are unused variables in Lib/test/test_collections.py versions: Python 3.4 Added file: http://bugs.python.org/file30432/test_copying.patch ___ Python tracker <http://bugs.python.org/issue18106> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18106] There are unused variables in Lib/test/test_collections.py
Vajrasky Kok added the comment: According to R. David Murray in Python core-mentorship mailing list addressing me: "It could be that the bug is that the i is not used...it may have been intended to be used in an extended error message in the asserts, so that it would be clear which input failed. In any case, I think the best fix here would probably be to use the new subtests support in unittest." So I used subTest feature in the second patch I upload according to his advice. What do you think? subTest can recognize where the test fails immediately as well. You just have to count the line in the loop. -- Added file: http://bugs.python.org/file30433/test_copying_with_subTest.patch ___ Python tracker <http://bugs.python.org/issue18106> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18106] There are unused variables in Lib/test/test_collections.py
Vajrasky Kok added the comment: Anyway to make it complete, I upload the patch according to Storchaka's advice too. May the best patch wins! -- Added file: http://bugs.python.org/file30434/test_copying_with_def.patch ___ Python tracker <http://bugs.python.org/issue18106> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18106] There are unused variables in Lib/test/test_collections.py
Vajrasky Kok added the comment: I redo the test as Terry J. Reedy suggested. I use label in loop, utilize subTest receiving label parameter, and pass messages to only necessary asserts. So roughly if the test fails, we would get something like this: == FAIL: test_copying (__main__.TestOrderedDict) (label='OrderedDict(od)') -- Traceback (most recent call last): File "Lib/test/test_collections.py", line 1237, in test_copying self.assertTrue(dup is not dup, msg) AssertionError: False is not true : copy: OrderedDict([('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)]) od: OrderedDict([('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)]) == FAIL: test_copying (__main__.TestCounter) (label='Counter(words)') -- Traceback (most recent call last): File "Lib/test/test_collections.py", line 942, in test_copying self.assertEqual(type(dup), type(''), msg) AssertionError: != : copy: Counter({'which': 2, 'witches': 1, 'witch': 1, 'watch': 1, 'wrist': 1, 'had': 1}) words: Counter({'which': 2, 'witches': 1, 'had': 1, 'watch': 1, 'witch': 1, 'wrist': 1}) -- Added file: http://bugs.python.org/file30443/test_with_label_and_subTest.patch ___ Python tracker <http://bugs.python.org/issue18106> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18116] getpass.getpass() triggers ResourceWarning
Vajrasky Kok added the comment: This bug happens in Python 3.4 as well. [sky@localhost cpython]$ ./python --version Python 3.4.0a0 [sky@localhost cpython]$ ./python /tmp/bugme.py /home/sky/Code/python/programming_language/cpython/Lib/os.py:1025: ResourceWarning: unclosed file <_io.FileIO name=3 mode='rb+'> return io.open(fd, *args, **kwargs) What's up? I tried to apply the patch manually (by copying, cutting and pasting) from Alex but Nikolaus is right. The patch does not work. The bug still happens -- nosy: +vajrasky ___ Python tracker <http://bugs.python.org/issue18116> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18116] getpass.getpass() triggers ResourceWarning
Vajrasky Kok added the comment: I isolate the bug. It happens in these lines: # Always try reading and writing directly on the tty first. fd = os.open('/dev/tty', os.O_RDWR|os.O_NOCTTY) tty = os.fdopen(fd, 'w+', 1) So to produce the bug more specifically, you can try this python file: # bugme2.py import os fd = os.open('/dev/tty', os.O_RDWR|os.O_NOCTTY) os.fdopen(fd, 'w+', 1) # end of bugme2.py In Linux Fedora 18, I would get this error: /home/sky/Code/python/programming_language/cpython/Lib/os.py:1025: ResourceWarning: unclosed file <_io.FileIO name=3 mode='rb+'> return io.open(fd, *args, **kwargs) Traceback (most recent call last): File "/tmp/bugme2.py", line 4, in os.fdopen(fd, 'w+', 1) File "/home/sky/Code/python/programming_language/cpython/Lib/os.py", line 1025, in fdopen return io.open(fd, *args, **kwargs) io.UnsupportedOperation: File or stream is not seekable. -- ___ Python tracker <http://bugs.python.org/issue18116> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18116] getpass.getpass() triggers ResourceWarning
Vajrasky Kok added the comment: I have investigated this problem and come up with the patch to fix the problem. This patch does the job. Caution: only for Python 3.4. But translating this patch to Python 3.3 should be straightforward. I hope this patch could be the foundation for better programmers to create better patch. Some of the issues with this patch are: I am not sure how to handle encoding and where the best place to close tty is. Reference: https://github.com/stefanholek/term/issues/1 http://stackoverflow.com/questions/5471158/typeerror-str-does-not-support-the-buffer-interface -- Added file: http://bugs.python.org/file30444/getpass_fix_resourcewarning.patch ___ Python tracker <http://bugs.python.org/issue18116> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18116] getpass.getpass() triggers ResourceWarning
Vajrasky Kok added the comment: Sorry, My previous patch breaks the test. This one should pass the test and fix the bug. Still, there are ugly code in the patch that I hope better programmers could fix. -- Added file: http://bugs.python.org/file30445/getpass_fix_resourcewarning_pass_the_test.patch ___ Python tracker <http://bugs.python.org/issue18116> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18116] getpass.getpass() triggers ResourceWarning
Vajrasky Kok added the comment: Based on the input from Benjamin Peterson, I grab encoding from the os module in the getpass module. I put some test as well. Until the whole function is rewritten, I hope this patch will suffice and do the job properly. -- Added file: http://bugs.python.org/file30463/getpass_tty_with_test.patch ___ Python tracker <http://bugs.python.org/issue18116> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18116] getpass.getpass() triggers ResourceWarning
Vajrasky Kok added the comment: So the correct fix should be: 1. Make sure we can open /dev/tty in non-binary mode, 2. We can write string to /dev/tty, 3. Close the leak if we can not open /dev/tty. Is it? -- ___ Python tracker <http://bugs.python.org/issue18116> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18116] getpass.getpass() triggers ResourceWarning
Vajrasky Kok added the comment: Fixing IO leak resource would fix this bug but leave another bug opened which I try to fix as well. These statements with Python3 under Linux will always fail because we need to open /dev/tty file in binary mode (for whatever reason). fd = os.open('/dev/tty', os.O_RDWR|os.O_NOCTTY) tty = os.fdopen(fd, 'w+', 1) So I guess the correct fix would be to open /dev/tty in binary mode (and set buffering off) and go on from there. Of course, one can argue whether this bug should be separated from the original bug (resource warning). I am not sure either. Anyway, here is the patch that will work with stream StringIO and stdout. Thank you for Serhiy for pointing out my mistakes. -- Added file: http://bugs.python.org/file30483/getpass_fix_works_with_stringio_and_stdout_stream.patch ___ Python tracker <http://bugs.python.org/issue18116> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18150] Duplicate test inside TestSingleDispatch
New submission from Vajrasky Kok: There is a duplicate test inside TestSingleDispatch in file Lib/test/test_functools.py. The method test_mro and test_classic_classes are not different at all. -- components: Tests files: duplicate_test_for_testsingledispatch.diff keywords: patch messages: 190717 nosy: lukasz.langa, vajrasky priority: normal severity: normal status: open title: Duplicate test inside TestSingleDispatch versions: Python 3.4 Added file: http://bugs.python.org/file30484/duplicate_test_for_testsingledispatch.diff ___ Python tracker <http://bugs.python.org/issue18150> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18150] Duplicate test inside TestSingleDispatch
Changes by Vajrasky Kok : Removed file: http://bugs.python.org/file30484/duplicate_test_for_testsingledispatch.diff ___ Python tracker <http://bugs.python.org/issue18150> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18150] Duplicate test inside TestSingleDispatch
Vajrasky Kok added the comment: I think to test the mro case, we have to test the multiple inheritance with the same ancestor case. Attached my guess of the correct test should be. -- Added file: http://bugs.python.org/file30491/test_mro.diff ___ Python tracker <http://bugs.python.org/issue18150> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18155] csv.Sniffer.has_header doesn't escape characters used in regex
Changes by Vajrasky Kok : Removed file: http://bugs.python.org/file30498/csv_has_header.diff ___ Python tracker <http://bugs.python.org/issue18155> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18155] csv.Sniffer.has_header doesn't escape characters used in regex
Vajrasky Kok added the comment: Attached the patch to fix the problem. -- keywords: +patch nosy: +vajrasky Added file: http://bugs.python.org/file30498/csv_has_header.diff ___ Python tracker <http://bugs.python.org/issue18155> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18155] csv.Sniffer.has_header doesn't escape characters used in regex
Vajrasky Kok added the comment: Sorry. This one is correct. Attached the patch to fix the problem. -- Added file: http://bugs.python.org/file30499/csv_has_header.diff ___ Python tracker <http://bugs.python.org/issue18155> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18155] csv.Sniffer.has_header doesn't escape characters used in regex
Changes by Vajrasky Kok : Removed file: http://bugs.python.org/file30499/csv_has_header.diff ___ Python tracker <http://bugs.python.org/issue18155> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18155] csv.Sniffer.has_header doesn't escape characters used in regex
Vajrasky Kok added the comment: Added test to sniffer double quote. -- Added file: http://bugs.python.org/file30501/csv_has_header.diff ___ Python tracker <http://bugs.python.org/issue18155> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18106] There are unused variables in Lib/test/test_collections.py
Vajrasky Kok added the comment: Fixed the test based on Ezio Melotti's advice. However, Ezio did not comment specifically about whether we should cut or keep this line. self.assertEqual(list(dup.items()), list(od.items())) After studying the OrderedDict source code, I came to conclusion that if "self.assertEqual(dup, od)" is true, so is "self.assertEqual(list(dup.items()), list(od.items()))". But if "self.assertEqual(dup, od)" is false, so is "self.assertEqual(list(dup.items()), list(od.items()))". This is how OrderedDict tests the equality: def __eq__(self, other): if isinstance(other, OrderedDict): return dict.__eq__(self, other) and all(map(_eq, self, other)) return dict.__eq__(self, other) So I think it should be safe to remove: self.assertEqual(list(dup.items()), list(od.items())) -- Added file: http://bugs.python.org/file30513/test_copying_trimmed.patch ___ Python tracker <http://bugs.python.org/issue18106> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17324] SimpleHTTPServer serves files even if the URL has a trailing slash
Vajrasky Kok added the comment: Attached the fix and the unit test for this problem. -- nosy: +vajrasky Added file: http://bugs.python.org/file30863/patch_for_fixing_the_server_serving_the_url_with_trailing_slash.txt ___ Python tracker <http://bugs.python.org/issue17324> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18352] collections.Counter with added attributes are not deepcopied properly.
Vajrasky Kok added the comment: The question is whether we should give the freedom to user to add dynamic attribute to Counter object. Is this freedom has any practicality? Why do we want to add dynamic attributes to Counter object? Decimal object does not have this freedom. >>> from decimal import Decimal >>> z = Decimal('1.0') >>> z.foo = 'a' Traceback (most recent call last): File "", line 1, in AttributeError: 'decimal.Decimal' object has no attribute 'foo' Actually I am not really sure about this. Maybe someone knows the answer. -- nosy: +vajrasky ___ Python tracker <http://bugs.python.org/issue18352> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18324] set_payload does not handle binary payloads correctly
Vajrasky Kok added the comment: Here is the preliminary patch for email module to pass the test. -- nosy: +vajrasky Added file: http://bugs.python.org/file30884/set_payload_handles_binary_correctly.txt ___ Python tracker <http://bugs.python.org/issue18324> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18324] set_payload does not handle binary payloads correctly
Vajrasky Kok added the comment: I see. Thanks for the explanation. I'll do this patch if nobody is interested. -- ___ Python tracker <http://bugs.python.org/issue18324> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18437] Typo in comment inside class Charset about output_charset
New submission from Vajrasky Kok: Python 3.4, line 197: output_charset: Some character sets must be converted before the can be It is supposed to be: output_charset: Some character sets must be converted before they can be -- assignee: docs@python components: Documentation files: fix_typo_charset.txt messages: 192990 nosy: docs@python, r.david.murray, vajrasky priority: normal severity: normal status: open title: Typo in comment inside class Charset about output_charset versions: Python 3.4 Added file: http://bugs.python.org/file30908/fix_typo_charset.txt ___ Python tracker <http://bugs.python.org/issue18437> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18438] Obsolete url in comment inside decimal module
New submission from Vajrasky Kok: Python 3.4, file Lib/decimal.py, line 24: www.cs.berkeley.edu/~ejr/projects/754/private/drafts/854-1987/dir.html If you go to the website, you'll encounter this error: The server has encountered a problem because the resource was not found. I could not find the replacement. The only thing that I could find is the paid material found here: http://ieeexplore.ieee.org/xpl/mostRecentIssue.jsp?punumber=2502 That's not good. -- assignee: docs@python components: Documentation messages: 192994 nosy: docs@python, rhettinger, vajrasky priority: normal severity: normal status: open title: Obsolete url in comment inside decimal module versions: Python 3.4 ___ Python tracker <http://bugs.python.org/issue18438> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11874] argparse assertion failure with brackets in metavars
Vajrasky Kok added the comment: Attached the unit test. Here is the simpler script to product the bug: import argparse parser = argparse.ArgumentParser(prog='PROG') parser.add_argument ('--a', metavar='a'*76) parser.add_argument ('--b', metavar="[innerpart]outerpart") parser.add_argument ('c', metavar='c'*76) parser.add_argument ('d', metavar="[innerpart2]outerpart2") args = parser.parse_args() python thefile.py --help -- nosy: +vajrasky Added file: http://bugs.python.org/file30910/unit_test_for_inner_bracket_metavar.txt ___ Python tracker <http://bugs.python.org/issue11874> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11874] argparse assertion failure with brackets in metavars
Vajrasky Kok added the comment: Sorry, got typo in last unit test. -- Added file: http://bugs.python.org/file30911/unit_test_for_inner_bracket_metavar.txt ___ Python tracker <http://bugs.python.org/issue11874> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11874] argparse assertion failure with brackets in metavars
Changes by Vajrasky Kok : Removed file: http://bugs.python.org/file30910/unit_test_for_inner_bracket_metavar.txt ___ Python tracker <http://bugs.python.org/issue11874> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11874] argparse assertion failure with brackets in metavars
Vajrasky Kok added the comment: Tidied up the unit test. Mixed with arguments without metavar. -- Added file: http://bugs.python.org/file30913/unit_test_argparse.txt ___ Python tracker <http://bugs.python.org/issue11874> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11874] argparse assertion failure with brackets in metavars
Vajrasky Kok added the comment: Attached the preliminary fix and the unit test for this ticket. -- Added file: http://bugs.python.org/file30915/fix_and_unit_test_for_argparse_inner_bracket_bug.txt ___ Python tracker <http://bugs.python.org/issue11874> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18453] There are unused variables inside DateTimeTestCase class in test_xmlrpc.py
New submission from Vajrasky Kok: Attached the menial fix to unit test in test_xmlrpc.py. -- components: Tests files: fix_DateTimeTestCase.txt messages: 193059 nosy: vajrasky priority: normal severity: normal status: open title: There are unused variables inside DateTimeTestCase class in test_xmlrpc.py versions: Python 3.4 Added file: http://bugs.python.org/file30919/fix_DateTimeTestCase.txt ___ Python tracker <http://bugs.python.org/issue18453> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18453] There are unused variables inside DateTimeTestCase class in test_xmlrpc.py
Vajrasky Kok added the comment: Okay, instead of using computer timer, I use mock object instead. -- Added file: http://bugs.python.org/file30920/fix_DateTimeTestCase_using_mock_object.txt ___ Python tracker <http://bugs.python.org/issue18453> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18464] Typo in the name of function in test__encoded_words.py
New submission from Vajrasky Kok: There is a typo in the name of function in test__encoded_words.py. Python 3.4, Lib/test/test_email/test__encoded_words.py, line 78: def test_q_escpaed_bytes_preserved(self): It is supposed to be (I guess): def test_q_escaped_bytes_preserved(self): -- components: Tests messages: 193111 nosy: r.david.murray, vajrasky priority: normal severity: normal status: open title: Typo in the name of function in test__encoded_words.py versions: Python 3.4 ___ Python tracker <http://bugs.python.org/issue18464> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11874] argparse assertion failure with brackets in metavars
Vajrasky Kok added the comment: paul j3, thanks for reviewing my patch and giving me credit in your patch for another ticket. Yeah, as you could see, the reason I return arg_parts and text is because the text still needs to undergo the cleanup process. You solved it by putting cleaning up in inner function. I am thinking whether it is best to do "assert ' '.join(opt_parts) == opt_usage" inside _format_actions_usage helper function. In that way, we can avoid returning the text. We can return only the arg_parts. Anyway, my patch still got some unused variables, notably part_regexp and inner. My bad. Let me check the code more deeply. See whether I can architect my patch in a better way. Maybe we can avoid building separate list inside _format_actions_usage. Beside of that, this bug is not introduced solely by bracket character. It needs another non-space character on the right side of it. This line is fine: parser.add_argument ('--b', metavar="[innerpart] outerpart") This line will fail the assertion: parser.add_argument ('--b', metavar="[innerpart]outerpart") -- ___ Python tracker <http://bugs.python.org/issue11874> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18465] There are unused variables and unused import in Lib/test/test_minidom.py
New submission from Vajrasky Kok: The unit test file imports verbose from test.support, but it never used it. The child2 variable inside testRemoveAttributeNode is not used. The doc variable inside testHasChildNodes is not used. Attached the menial fix for this unit test. -- components: Tests files: fix_for_unused_variables_and_unused_import_in_test_minidom.txt messages: 193113 nosy: vajrasky priority: normal severity: normal status: open title: There are unused variables and unused import in Lib/test/test_minidom.py versions: Python 3.4 Added file: http://bugs.python.org/file30929/fix_for_unused_variables_and_unused_import_in_test_minidom.txt ___ Python tracker <http://bugs.python.org/issue18465> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18475] No unittest.main in Lib/test/test_email/test_inversion.py
New submission from Vajrasky Kok: There is no unittest.main in Lib/test/test_email/test_inversion.py. In other word, you can not execute the test by doing something like this: [abcdef@localhost cpython]$ ./python Lib/test/test_email/test_inversion.py Attached the menial fix. -- components: Tests files: add_unittest_main_to_test_inversion.txt messages: 193168 nosy: r.david.murray, vajrasky priority: normal severity: normal status: open title: No unittest.main in Lib/test/test_email/test_inversion.py versions: Python 3.4 Added file: http://bugs.python.org/file30939/add_unittest_main_to_test_inversion.txt ___ Python tracker <http://bugs.python.org/issue18475> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18483] Add hour-24 type of time to test_http2time_formats in test_http_cookiejar.py
New submission from Vajrasky Kok: In test_http2time_formats test function, they test many type of date & time format, such as: ... 'Thu, 03 Feb 1994 00:00:00 GMT', # proposed new HTTP format 'Thursday, 03-Feb-94 00:00:00 GMT', # old rfc850 HTTP format 'Thursday, 03-Feb-1994 00:00:00 GMT', # broken rfc850 HTTP format '03 Feb 1994 00:00:00 GMT', # HTTP format (no weekday) ... I think it would be a good idea to add hour-24 to this list. See the patch file. -- components: Tests files: add_hour_24_in_test_http2time_format.txt messages: 193236 nosy: vajrasky priority: normal severity: normal status: open title: Add hour-24 type of time to test_http2time_formats in test_http_cookiejar.py versions: Python 3.4 Added file: http://bugs.python.org/file30953/add_hour_24_in_test_http2time_format.txt ___ Python tracker <http://bugs.python.org/issue18483> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18484] No unit test for iso2time function from http.cookiejar module
New submission from Vajrasky Kok: >From http.cookiejar module, we have http2time and iso2time functions. We have unit test for http2time, but not for iso2time. That's not fair. Attached the extended coverage test for iso2time function. -- components: Tests files: add_iso2time_test.txt messages: 193241 nosy: vajrasky priority: normal severity: normal status: open title: No unit test for iso2time function from http.cookiejar module versions: Python 3.4 Added file: http://bugs.python.org/file30954/add_iso2time_test.txt ___ Python tracker <http://bugs.python.org/issue18484> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17214] http.client.HTTPConnection.putrequest encode error
Vajrasky Kok added the comment: The script for demonstrating bug can be simplified to: --- import urllib.request url = "http://www.libon.it/ricerca/7817940/3499155443/dettaglio/3102314/Onkel-Oswald-und-der-Sudan-Käfer/order/date_desc"; req = urllib.request.Request(url) response = urllib.request.urlopen(req, timeout=30) the_page = response.read().decode('utf-8') print(the_page) --- Attached the simple patch to solve this problem. The question is whether we should fix this problem in urllib or not because strictly speaking the url should be ascii characters only. But if the Firefox can open this url, why not urllib? I will contemplate about this problem and if I (or other people) think that urllib should handle url containing non-ascii characters, then I will add additional unit test. Until then, people can use third party package, which is request package from http://docs.python-requests.org/en/latest/ r = requests.get("http://www.libon.it/ricerca/7817940/3499155443/dettaglio/3102314/Onkel-Oswald-und-der-Sudan-Käfer/order/date_desc";) print(r.text) -- nosy: +vajrasky Added file: http://bugs.python.org/file30964/patch_to_urllib_handle_non_ascii_char_in_url.txt ___ Python tracker <http://bugs.python.org/issue17214> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17214] http.client.HTTPConnection.putrequest encode error
Vajrasky Kok added the comment: I have no problem if this ticket is classified as "won't fix". I am writing this for the confused souls who want to use urllib to access url containing non-ascii characters: import urllib.request from urllib.parse import quote url = "http://www.libon.it/ricerca/7817940/3499155443/dettaglio/3102314/Onkel-Oswald-und-der-Sudan-Käfer/order/date_desc"; req = urllib.request.Request(url) try: req.selector.encode('ascii') except UnicodeEncodeError: req.selector = quote(req.selector) response = urllib.request.urlopen(req, timeout=30) the_page = response.read().decode('utf-8') print(the_page) -- ___ Python tracker <http://bugs.python.org/issue17214> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17214] http.client.HTTPConnection.putrequest encode error
Vajrasky Kok added the comment: Lars, I see. For the uninitiated, the issue is the original url (containing only ascii character) redirects to the url containing non-ascii characters which upsets urllib. To handle that situation, you can do something like this: - import urllib.request from urllib.parse import quote url = "http://www.libon.it/libon/search/isbn/3499155443"; req = urllib.request.Request(url) req.selector = urllib.parse.quote(req.selector) response = urllib.request.urlopen(req, timeout=30) the_page = response.read().decode('utf-8') print(the_page) - I admit it that this code is clunky and not pythonic. I also believe in python standard library, we should have a module to access url containing non-ascii character in an easy manner. At the very least, maybe we can give proper error message. Something like this would be nice: "The url is not valid and contains non-ascii character: http://www.libon.it/ricerca/7817940/3499155443/dettaglio/3102314/Onkel-Oswald-und-der-Sudan-Käfer/order/date_desc. This url is redirected from this url: http://www.libon.it/libon/search/isbn/3499155443"; Because users can be confused. They thought they already gave only-ascii-characters url (http://www.libon.it/libon/search/isbn/3499155443) to urllib, but why did they get encoding error? What do you say, Christian? -- ___ Python tracker <http://bugs.python.org/issue17214> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18503] No assertion in test_del_param_on_nonexistent_header function
New submission from Vajrasky Kok: In Lib/test/test_email/test_email.py, line 389, there is a unit test function: def test_del_param_on_nonexistent_header(self): msg = Message() msg.del_param('filename', 'content-disposition') There is no assertion here, unlike other unit test functions, such as: def test_del_param_on_other_header(self): msg = Message() msg.add_header('Content-Disposition', 'attachment', filename='bud.gif') msg.del_param('filename', 'content-disposition') self.assertEqual(msg['content-disposition'], 'attachment') -- components: Tests files: add_assert_equal_on_test_del_param_on_nonexistent_header.txt messages: 193356 nosy: r.david.murray, vajrasky priority: normal severity: normal status: open title: No assertion in test_del_param_on_nonexistent_header function versions: Python 3.4 Added file: http://bugs.python.org/file30977/add_assert_equal_on_test_del_param_on_nonexistent_header.txt ___ Python tracker <http://bugs.python.org/issue18503> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18503] No assertion in test_del_param_on_nonexistent_header function
Vajrasky Kok added the comment: Anyway, I found another issue on line 393 on the same file: def test_del_nonexistent_param(self): msg = Message() msg.add_header('Content-Type', 'text/plain', charset='utf-8') existing_header = msg['Content-Type'] msg.del_param('foobar', header='Content-Type') self.assertEqual(msg['Content-Type'], 'text/plain; charset="utf-8"') The variable existing_header is never used. Either we can remove it or change it to: def test_del_nonexistent_param(self): msg = Message() msg.add_header('Content-Type', 'text/plain', charset='utf-8') existing_header = msg['Content-Type'] msg.del_param('foobar', header='Content-Type') self.assertEqual(msg['Content-Type'], existing_header) At first, I wanted to create a ticket for this. But then, I thought why do not we combine these menial problems together? -- ___ Python tracker <http://bugs.python.org/issue18503> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18505] Duplicate function names in test_email.py
New submission from Vajrasky Kok: In Lib/test/test_email/test_email.py, Part 1: line 4210 and 4217 have same function name, which is test_encode_one_long_line. In fact, they have same function body! def test_encode_one_long_line(self): self._test_encode('x' * 100 + '\n', 'x' * 75 + '=\n' + 'x' * 25 + '\n') One of them can be removed. Part 2: line 928 and 1009 have same function name, which is test_splitter_split_on_punctuation_only_if_fws. This time, they have different function body and one of them (line 928) is overshadowed (not being executed by unit test) by the other. So we must rename one of them. -- components: Tests files: fix_duplicate_function_names.txt messages: 193366 nosy: r.david.murray, vajrasky priority: normal severity: normal status: open title: Duplicate function names in test_email.py versions: Python 3.4 Added file: http://bugs.python.org/file30981/fix_duplicate_function_names.txt ___ Python tracker <http://bugs.python.org/issue18505> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16595] Add resource.prlimit
Vajrasky Kok added the comment: Fedora 18, this is the result after applying your patch and execute your unit test: [sky@localhost cpython]$ ./python Lib/test/test_resource.py test_args (__main__.ResourceTest) ... ok test_fsize_enforced (__main__.ResourceTest) ... ok test_fsize_ismax (__main__.ResourceTest) ... ok test_fsize_toobig (__main__.ResourceTest) ... ok test_getrusage (__main__.ResourceTest) ... ok test_prlimit (__main__.ResourceTest) ... ERROR test_setrusage_refcount (__main__.ResourceTest) ... ok == ERROR: test_prlimit (__main__.ResourceTest) -- Traceback (most recent call last): File "Lib/test/test_resource.py", line 131, in test_prlimit 1, resource.RLIMIT_AS) File "/home/sky/Code/python/programming_language/cpython/Lib/unittest/case.py", line 614, in assertRaises return context.handle('assertRaises', callableObj, args, kwargs) File "/home/sky/Code/python/programming_language/cpython/Lib/unittest/case.py", line 150, in handle callable_obj(*args, **kwargs) PermissionError: [Errno 1] Operation not permitted -- Ran 7 tests in 0.990s FAILED (errors=1) Traceback (most recent call last): File "Lib/test/test_resource.py", line 143, in test_main() File "Lib/test/test_resource.py", line 140, in test_main support.run_unittest(ResourceTest) File "/home/sky/Code/python/programming_language/cpython/Lib/test/support.py", line 1615, in run_unittest _run_suite(suite) File "/home/sky/Code/python/programming_language/cpython/Lib/test/support.py", line 1590, in _run_suite raise TestFailed(err) test.support.TestFailed: Traceback (most recent call last): File "Lib/test/test_resource.py", line 131, in test_prlimit 1, resource.RLIMIT_AS) File "/home/sky/Code/python/programming_language/cpython/Lib/unittest/case.py", line 614, in assertRaises return context.handle('assertRaises', callableObj, args, kwargs) File "/home/sky/Code/python/programming_language/cpython/Lib/unittest/case.py", line 150, in handle callable_obj(*args, **kwargs) PermissionError: [Errno 1] Operation not permitted With sudo, I got this: [sky@localhost cpython]$ sudo ./python Lib/test/test_resource.py [sudo] password for sky: test_args (__main__.ResourceTest) ... ok test_fsize_enforced (__main__.ResourceTest) ... ok test_fsize_ismax (__main__.ResourceTest) ... ok test_fsize_toobig (__main__.ResourceTest) ... ok test_getrusage (__main__.ResourceTest) ... ok test_prlimit (__main__.ResourceTest) ... FAIL test_setrusage_refcount (__main__.ResourceTest) ... ok == FAIL: test_prlimit (__main__.ResourceTest) -- Traceback (most recent call last): File "Lib/test/test_resource.py", line 131, in test_prlimit 1, resource.RLIMIT_AS) AssertionError: ValueError not raised by prlimit -- Ran 7 tests in 1.002s FAILED (failures=1) Traceback (most recent call last): File "Lib/test/test_resource.py", line 143, in test_main() File "Lib/test/test_resource.py", line 140, in test_main support.run_unittest(ResourceTest) File "/home/sky/Code/python/programming_language/cpython/Lib/test/support.py", line 1615, in run_unittest _run_suite(suite) File "/home/sky/Code/python/programming_language/cpython/Lib/test/support.py", line 1590, in _run_suite raise TestFailed(err) test.support.TestFailed: Traceback (most recent call last): File "Lib/test/test_resource.py", line 131, in test_prlimit 1, resource.RLIMIT_AS) AssertionError: ValueError not raised by prlimit -- nosy: +vajrasky ___ Python tracker <http://bugs.python.org/issue16595> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18503] No assertion in test_del_param_on_nonexistent_header function
Vajrasky Kok added the comment: I see. Anyway, I am just curious. Why not doing try and catch? def test_del_param_on_nonexistent_header(self): msg = Message() try: msg.del_param('filename', 'content-disposition') except: self.fail('del_param on empty msg raised exception!') Or is it better this way? def test_del_param_on_nonexistent_header(self): msg = Message() # Deleting param on empty msg should not raise exception. msg.del_param('filename', 'content-disposition') -- ___ Python tracker <http://bugs.python.org/issue18503> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18503] No assertion in test_del_param_on_nonexistent_header function and unused variables in some places in test_email.py
Vajrasky Kok added the comment: Another unused variable in line 2268 on function test_bad_multipart: def test_bad_multipart(self): eq = self.assertEqual msg1 = Message() msg1['Subject'] = 'subpart 1' msg2 = Message() msg2['Subject'] = 'subpart 2' r = MIMEMessage(msg1) self.assertRaises(errors.MultipartConversionError, r.attach, msg2) The variable eq is never used and can be removed. I have changed the title of the ticket to reflect the problem better. -- title: No assertion in test_del_param_on_nonexistent_header function -> No assertion in test_del_param_on_nonexistent_header function and unused variables in some places in test_email.py ___ Python tracker <http://bugs.python.org/issue18503> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18503] No assertion in test_del_param_on_nonexistent_header function and unused variables in some places in test_email.py
Vajrasky Kok added the comment: Okay, next time I'll separate the problems into different tickets. Here is the patch to clean up the test. -- Added file: http://bugs.python.org/file30988/small_clean_up_to_test_email.txt ___ Python tracker <http://bugs.python.org/issue18503> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18516] Typos in Lib/email/generator.py and Lib/email/architecture.rst
New submission from Vajrasky Kok: [sky@localhost cpython]$ grep -n boudary Lib/email/generator.py 352:# _make_boudary = Generator._make_boundary [sky@localhost cpython]$ grep -n fuzy Lib/email/architecture.rst 27:This division is intentionally a bit fuzy; the API described by this documentation In addition to that, I found inconsistency in plural form of tuple. [sky@localhost cpython]$ grep -n "\-tuple" Lib/email/utils.py 79:"""The inverse of parseaddr(), this takes a 2-tuple of the form 285:params is a sequence of 2-tuples containing (param name, string value). 291:# 3-tuple of the continuation number, the string value, and a flag But I think this issue is very very trivial and we can ignore it. -- assignee: docs@python components: Documentation messages: 193425 nosy: docs@python, r.david.murray, vajrasky priority: normal severity: normal status: open title: Typos in Lib/email/generator.py and Lib/email/architecture.rst versions: Python 3.4 ___ Python tracker <http://bugs.python.org/issue18516> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18516] Typos in Lib/email/generator.py and Lib/email/architecture.rst
Vajrasky Kok added the comment: Sorry, my bad. The tuple pluralization is correct. I read it wrongly. -- ___ Python tracker <http://bugs.python.org/issue18516> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18324] set_payload does not handle binary payloads correctly
Vajrasky Kok added the comment: Here is the patch for this ticket. David Murray, am I on the right path? If yes, I'll put more robust tests, such as the ones with Asian encodings and unusual encodings. -- Added file: http://bugs.python.org/file30997/set_payload_binary.txt ___ Python tracker <http://bugs.python.org/issue18324> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18324] set_payload does not handle binary payloads correctly
Changes by Vajrasky Kok : Removed file: http://bugs.python.org/file30997/set_payload_binary.txt ___ Python tracker <http://bugs.python.org/issue18324> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18324] set_payload does not handle binary payloads correctly
Vajrasky Kok added the comment: Sorry, got typo for the last patch. -- Added file: http://bugs.python.org/file30998/set_payload_binary.txt ___ Python tracker <http://bugs.python.org/issue18324> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18324] set_payload does not handle binary payloads correctly
Vajrasky Kok added the comment: "It looks like you are still patching get_payload. This should be a really simple patch against set_payload." Okay, do I get it right at this time? About your second point, I need more time to think about it. -- Added file: http://bugs.python.org/file31000/set_payload_binary_v2.txt ___ Python tracker <http://bugs.python.org/issue18324> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18563] No unit test for yiq to rgb and rgb to yiq converting functions
New submission from Vajrasky Kok: Module colorsys has hsv_to_rgb, rgb_to_hsv, hls_to_rgb, rgb_to_hls, yiq_to_rgb, rgb_to_yig public API functions. But only hsv_to_rgb, rgb_to_hsv, hls_to_rgb, rgb_to_hls functions are being unit tested. Attached the patch for adding unit test to cover the yiq_to_rgb, rgb_to_yig functions as well. -- components: Tests files: unit_test_for_yiq.txt messages: 193734 nosy: vajrasky priority: normal severity: normal status: open title: No unit test for yiq to rgb and rgb to yiq converting functions versions: Python 3.4 Added file: http://bugs.python.org/file31040/unit_test_for_yiq.txt ___ Python tracker <http://bugs.python.org/issue18563> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18324] set_payload does not handle binary payloads correctly
Vajrasky Kok added the comment: Here is the third version of the patch. I am not sure what to do with the invalid data for base64 and uuencode. I decided to raise exception instead of converting it to None silently. -- Added file: http://bugs.python.org/file31049/set_payload_binary_v3.txt ___ Python tracker <http://bugs.python.org/issue18324> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18581] Duplicate test and missing class test in test_abc.py
New submission from Vajrasky Kok: There are two classes in Lib/test/test_abc.py, which are TestABC and TestLegacyAPI. Only TestABC is being unit tested. Beside that TestLegacyAPI class has one duplicate test, which is test_abstractmethod_integration with TestABC class. -- components: Tests files: legacy_api_unit_test.txt messages: 193831 nosy: vajrasky priority: normal severity: normal status: open title: Duplicate test and missing class test in test_abc.py versions: Python 3.4 Added file: http://bugs.python.org/file31065/legacy_api_unit_test.txt ___ Python tracker <http://bugs.python.org/issue18581> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18585] Add a text truncation function
Vajrasky Kok added the comment: Something is not right if we use more than one space. >>> textwrap.summarize('hello world!', width=12) 'hello world!' >>> textwrap.summarize('hello world!', width=11) 'hello (...)' >>> textwrap.summarize('hello world!', width=10) '(...)' I expect the last statement would give result: 'hello (...)' because 'hello' is just 5 characters, less than 10. -- nosy: +vajrasky ___ Python tracker <http://bugs.python.org/issue18585> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18585] Add a text truncation function
Vajrasky Kok added the comment: Beside of that, I notice the new lines are deleted silently. >>> textwrap.summarize('republicans are red,\ndemocrats are blue,\nneither one >>> of them,\ncares about you.', width=46) 'republicans are red, democrats are blue, (...)' -- ___ Python tracker <http://bugs.python.org/issue18585> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18593] Typo in Lib/multiprocessing/heap.py
New submission from Vajrasky Kok: $ grep Inheirtable Lib/multiprocessing/* Lib/multiprocessing/heap.py:# Inheirtable class which wraps an mmap, and from which blocks can be allocated -- assignee: docs@python components: Documentation messages: 193913 nosy: docs@python, vajrasky priority: normal severity: normal status: open title: Typo in Lib/multiprocessing/heap.py versions: Python 3.4 ___ Python tracker <http://bugs.python.org/issue18593> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18585] Add a text truncation function
Vajrasky Kok added the comment: Monsieur Pitrou, thanks for the explanation. Actually, IMHO I prefer, 'hello (...)' should be the minimum words we can use not '(...)' because '(...)' does not make any sense. But, anyway, it's your call. :) Anyway, using your summarize2.patch: >>> textwrap.summarize('hello world!', width=6) '(...)' >>> textwrap.summarize('hello world!', width=5) Traceback (most recent call last): File "", line 1, in File "/home/ethan/Documents/code/python/cpython/Lib/textwrap.py", line 378, in summarize return w.summarize(text, placeholder=placeholder) File "/home/ethan/Documents/code/python/cpython/Lib/textwrap.py", line 314, in summarize raise ValueError("placeholder too large for max width") ValueError: placeholder too large for max width Why? '(...)' is 5 characters only. I checked the patch and found out that the placeholder is ' (...)' (with space) and you compare the width with the placeholder. -- ___ Python tracker <http://bugs.python.org/issue18585> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1666318] shutil.copytree doesn't give control over directory permissions
Vajrasky Kok added the comment: Hi Catherine, I saw your patch. It looks good, except you are trying to copy the directory onto its subdirectory. src_dir = tempfile.mkdtemp() dst_dir = os.path.join(tempfile.mkdtemp(), 'destination') I prefer it if you copy it to somewhere else. This would be better: tmp_dir = self.mkdtemp() src = os.path.join(tmp_dir, 'foo') dst = os.path.join(tmp_dir, 'bar') -- nosy: +vajrasky ___ Python tracker <http://bugs.python.org/issue1666318> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18627] Typo in Modules/hashlib.h
New submission from Vajrasky Kok: Got typo in Modules/hashlib.h. See this patch for detail: --- a/Modules/hashlib.h Wed Jul 31 20:48:26 2013 -0400 +++ b/Modules/hashlib.h Fri Aug 02 12:39:00 2013 +0800 @@ -2,7 +2,7 @@ /* * Given a PyObject* obj, fill in the Py_buffer* viewp with the result - * of PyObject_GetBuffer. Sets and exception and issues a return NULL + * of PyObject_GetBuffer. Sets an exception and issues a return NULL * on any errors. */ #define GET_BUFFER_VIEW_OR_ERROUT(obj, viewp) do { \ -- assignee: docs@python components: Documentation messages: 194151 nosy: docs@python, vajrasky priority: normal severity: normal status: open title: Typo in Modules/hashlib.h versions: Python 3.4 ___ Python tracker <http://bugs.python.org/issue18627> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18606] Add statistics module to standard library
Vajrasky Kok added the comment: "Is there a reason why there is no 'review' link? Could it be because the file is uploaded as is rather than as a patch?" I think I can answer this question. The answer is yes. You can have "review" only if you use diff not raw file. The original poster, Steven D'Aprano, uploaded the raw file instead of diff. To upload the new file as a diff, (assuming he is using mercurial) he can do something like this: hg add Lib/statistics.py hg diff Lib/statistics.py > /tmp/statistics_diff.patch Then he can upload the statistics_diff.patch. Of course, this is just my hypothetical guess. -- nosy: +vajrasky ___ Python tracker <http://bugs.python.org/issue18606> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18644] Got ResourceWarning: unclosed file when using test function from formatter module
New submission from Vajrasky Kok: This python is compiled with --with-pydebug option. [sky@localhost cpython]$ cat /tmp/a.txt manly man likes cute cat. [sky@localhost cpython]$ ./python Python 3.4.0a0 (default:e408e821d6c8, Jul 27 2013, 10:49:54) [GCC 4.7.2 20121109 (Red Hat 4.7.2-8)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from formatter import test >>> test('/tmp/a.txt') manly man likes cute cat. __main__:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/a.txt' mode='r' encoding='UTF-8'> >>> [sky@localhost cpython]$ ./python Lib/formatter.py /tmp/a.txt manly man likes cute cat. Lib/formatter.py:445: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/a.txt' mode='r' encoding='UTF-8'> test() -- components: Tests files: formatter_fix_resource_warning.patch keywords: patch messages: 194260 nosy: vajrasky priority: normal severity: normal status: open title: Got ResourceWarning: unclosed file when using test function from formatter module type: resource usage versions: Python 3.4 Added file: http://bugs.python.org/file31138/formatter_fix_resource_warning.patch ___ Python tracker <http://bugs.python.org/issue18644> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18644] Got ResourceWarning: unclosed file when using test function from formatter module
Vajrasky Kok added the comment: Sorry, I forgot about stdin. Attached the patch to handle stdin gracefully. -- Added file: http://bugs.python.org/file31139/formatter_fix_resource_warning_v2.patch ___ Python tracker <http://bugs.python.org/issue18644> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18644] Got ResourceWarning: unclosed file when using test function from formatter module
Vajrasky Kok added the comment: I guess I should not close stdin just in case people are using test function in the script. Attached the patch to only close the open files not stdin. -- Added file: http://bugs.python.org/file31140/formatter_fix_resource_warning_v3.patch ___ Python tracker <http://bugs.python.org/issue18644> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18658] Mercurial CPython log ticket link is broken
New submission from Vajrasky Kok: Go to http://hg.python.org/cpython. All ticket links (number preceded by #), such as #18567 refer to bugs in jython. For example: 5 hours ago R David Murray Merge: #18657: remove duplicate entries from Misc/ACKS.default tip 5 hours ago R David Murray #18657: remove duplicate entries from Misc/ACKS.3.3 The "Merge" link refers to correct place. But "#18657" goes to http://bugs.jython.org/issue18657. It happens to *all ticket links*. -- messages: 19 nosy: vajrasky priority: normal severity: normal status: open title: Mercurial CPython log ticket link is broken ___ Python tracker <http://bugs.python.org/issue18658> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18658] Mercurial CPython log ticket link is broken
Vajrasky Kok added the comment: Okay, it looks like it has been fixed. The format has changed as well. Previously: 5 hours ago R David Murray Merge: #18657: remove duplicate entries from Misc/ACKS.default tip 5 hours ago R David Murray #18657: remove duplicate entries from Misc/ACKS.3.3 Now: 10 hours agoR David Murray Merge: #18657: remove duplicate entries from Misc/ACKS. [#18657] default 10 hours agoR David Murray #18657: remove duplicate entries from Misc/ACKS. [#18657] 3.3 Now we have separate link to ticket (inside the bracket) at the end of commit message, whereas previously it was inside the commit message. I guess we can close this ticket as fixed. -- ___ Python tracker <http://bugs.python.org/issue18658> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18658] Mercurial CPython log ticket link is broken
Vajrasky Kok added the comment: Wait, something weird is happening in CPython commits log website, http://hg.python.org/cpython . These are the latest four commits. age author description 45 hours agoJason R. Coombs Issue 18532: Added tests and documentation to formally specify the .name attribute on hashlib objects.default tip 105 minutes ago Raymond Hettinger Silence compiler warning for unused declaration.2.7 11 hours agoR David Murray Merge: #18657: remove duplicate entries from Misc/ACKS. [#18657] 11 hours agoR David Murray #18657: remove duplicate entries from Misc/ACKS. [#18657]3.3 The "age" column is screwed up. 11 hours ago goes to 105 minutes ago then goes back to 45 hours ago. -- ___ Python tracker <http://bugs.python.org/issue18658> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18659] test_precision in test_format.py is not executed and has unused variable
New submission from Vajrasky Kok: There is test_precision in Lib/test_format.py which is not being unit tested. Also, there is a unused variable inside test_precision. Attached the patch to fix these problems. -- components: Tests files: test_precision.patch keywords: patch messages: 194459 nosy: vajrasky priority: normal severity: normal status: open title: test_precision in test_format.py is not executed and has unused variable versions: Python 3.4 Added file: http://bugs.python.org/file31162/test_precision.patch ___ Python tracker <http://bugs.python.org/issue18659> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18661] Typo in grpmodule.c
New submission from Vajrasky Kok: I guess, there is a typo in Modules/grpmodule.c. See the patch below: diff -r f4f81ebc3de9 Modules/grpmodule.c --- a/Modules/grpmodule.c Sun Aug 04 15:50:08 2013 -0400 +++ b/Modules/grpmodule.c Mon Aug 05 17:40:33 2013 +0800 @@ -10,7 +10,7 @@ {"gr_name", "group name"}, {"gr_passwd", "password"}, {"gr_gid", "group id"}, - {"gr_mem", "group memebers"}, + {"gr_mem", "group members"}, {0} }; I am not sure whether the line after typo should be {0} or {0, 0}. -- assignee: docs@python components: Documentation messages: 194465 nosy: docs@python, vajrasky priority: normal severity: normal status: open title: Typo in grpmodule.c versions: Python 3.4 ___ Python tracker <http://bugs.python.org/issue18661> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18659] test_precision in test_format.py is not executed and has unused variable
Vajrasky Kok added the comment: Let me help you to debug this issue. ethan@amiau:~/Documents/code/python/cpython$ cat /tmp/a.py import sys INT_MAX = sys.maxsize f = 1.2 format(f, ".%sf" % (INT_MAX + 1)) ethan@amiau:~/Documents/code/python/cpython$ ./python /tmp/a.py Traceback (most recent call last): File "/tmp/a.py", line 5, in format(f, ".%sf" % (INT_MAX + 1)) ValueError: Too many decimal digits in format string ethan@amiau:~/Documents/code/python/cpython$ cat /tmp/b.py import sys INT_MAX = 2147483647 f = 1.2 format(f, ".%sf" % (INT_MAX + 1)) ethan@amiau:~/Documents/code/python/cpython$ ./python /tmp/b.py Traceback (most recent call last): File "/tmp/b.py", line 5, in format(f, ".%sf" % (INT_MAX + 1)) ValueError: precision too big My question is whether we should have different exception message for these two cases? -- ___ Python tracker <http://bugs.python.org/issue18659> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18659] test_precision in test_format.py is not executed and has unused variable
Vajrasky Kok added the comment: For now, instead of hardcoding INT_MAX to 2147483647 in test, maybe we can use module: >>> import IN >>> IN.INT_MAX 2147483647 -- ___ Python tracker <http://bugs.python.org/issue18659> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18659] test_precision in test_format.py is not executed and has unused variable
Vajrasky Kok added the comment: For the passers-by who want to help: The "precision too big" exception is raised in Python/formatter_unicode.c line 1168 and 1002. The "Too many decimal digits..." exception is raised in Python/formatter_unicode.c line 71. So the question is whether it is beneficial to differentiate the exception message. If not, we can change the exception message or test whether the digit passes INT_MAX first before checking with sys.max_size. If yes, we need to add test case for sys.max_size and use _testcapi.INT_MAX for current unit test case. -- ___ Python tracker <http://bugs.python.org/issue18659> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18659] test_precision in test_format.py is not executed and has unused variable
Vajrasky Kok added the comment: Okay, I guess the fix for this ticket should be kept simple. If we want to merge the exception message or touch the code base or do something smarter than fixing the test, maybe we should create a separate ticket. So I used Serhiy Storchaka's suggestion to use _testcapi.INT_MAX for the second patch. -- Added file: http://bugs.python.org/file31164/test_precision_v2.patch ___ Python tracker <http://bugs.python.org/issue18659> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18659] test_precision in test_format.py is not executed and has unused variable
Vajrasky Kok added the comment: Attached the third patch. The importing _testcapi part was moved inside the test. Added cpython support only decorator for this test. -- Added file: http://bugs.python.org/file31169/test_precision_v3.patch ___ Python tracker <http://bugs.python.org/issue18659> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18665] Typos in frame object related code
New submission from Vajrasky Kok: See the patch for details: diff -r 438cdc97d8ee Include/frameobject.h --- a/Include/frameobject.h Mon Aug 05 23:35:43 2013 +0200 +++ b/Include/frameobject.h Tue Aug 06 12:38:15 2013 +0800 @@ -36,7 +36,7 @@ non-generator frames. See the save_exc_state and swap_exc_state functions in ceval.c for details of their use. */ PyObject *f_exc_type, *f_exc_value, *f_exc_traceback; -/* Borrowed referenced to a generator, or NULL */ +/* Borrowed reference to a generator, or NULL */ PyObject *f_gen; PyThreadState *f_tstate; diff -r 438cdc97d8ee Lib/test/test_frame.py --- a/Lib/test/test_frame.pyMon Aug 05 23:35:43 2013 +0200 +++ b/Lib/test/test_frame.pyTue Aug 06 12:38:15 2013 +0800 @@ -93,7 +93,7 @@ @support.cpython_only def test_clear_refcycles(self): -# .clear() doesn't leave any refcycle behin +# .clear() doesn't leave any refcycle behind. with support.disable_gc(): class C: pass About the second comment, I am not sure to put dot or not. In that file, I saw some comments use dot, others don't. -- assignee: docs@python components: Documentation messages: 194523 nosy: docs@python, pitrou, vajrasky priority: normal severity: normal status: open title: Typos in frame object related code versions: Python 3.4 ___ Python tracker <http://bugs.python.org/issue18665> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18666] Unused variable in test_frame.py
New submission from Vajrasky Kok: There is a unused variable in Lib/test/test_frame.py. def test_clear_executing_generator(self): # Attempting to clear an executing generator frame is forbidden. endly = False def g(): nonlocal endly try: 1/0 except ZeroDivisionError as e: f = e.__traceback__.tb_frame with self.assertRaises(RuntimeError): f.clear() with self.assertRaises(RuntimeError): f.f_back.clear() yield f finally: endly = True gen = g() f = next(gen) self.assertFalse(endly) The variable f is hanging without any purpose. Attached the patch to give purpose to variable f. -- components: Tests files: test_frame.patch keywords: patch messages: 194524 nosy: pitrou, vajrasky priority: normal severity: normal status: open title: Unused variable in test_frame.py versions: Python 3.4 Added file: http://bugs.python.org/file31170/test_frame.patch ___ Python tracker <http://bugs.python.org/issue18666> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18665] Typos in frame object related code
Vajrasky Kok added the comment: Okay, attached the patch to fix the typo. -- keywords: +patch Added file: http://bugs.python.org/file31171/fix_typo_frame_object.patch ___ Python tracker <http://bugs.python.org/issue18665> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18670] Using read_mime_types function from mimetypes module gives resource warning
New submission from Vajrasky Kok: [sky@localhost cpython]$ cat /tmp/a.txt x-application/mimea mimea application/mimeb mimeb [sky@localhost cpython]$ cat /tmp/a.py import warnings warnings.simplefilter('default') import mimetypes mimetypes.read_mime_types('/tmp/a.txt') [sky@localhost cpython]$ python3 /tmp/a.py /tmp/a.py:7: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/a.txt' mode='r' encoding='UTF-8'> mimetypes.read_mime_types('/tmp/a.txt') Attached the patch to fix the resource warning problem. -- components: Library (Lib) files: fix_resource_warning_read_mime_types.patch keywords: patch messages: 194557 nosy: vajrasky priority: normal severity: normal status: open title: Using read_mime_types function from mimetypes module gives resource warning type: resource usage versions: Python 3.4 Added file: http://bugs.python.org/file31176/fix_resource_warning_read_mime_types.patch ___ Python tracker <http://bugs.python.org/issue18670> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com