[issue33212] add several options to msgfmt.py
umedoblock <umedobl...@gmail.com> added the comment: Sorry, I forgot to add a patch file. -- keywords: +patch Added file: https://bugs.python.org/file47518/a.patch ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33212> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33212] add several options to msgfmt.py
New submission from umedoblock <umedobl...@gmail.com>: = Why do I add several options ? I'd like to effectively know a progress of translate about some po files when KiCad dev team announce to public KiCad 5.0 major. Because KiCad dev team separates PCB design tools to exe files. And I used the poedit to translate work. Then I'd like to know progress per a po file. Please take my idea in msgfmt.py. == help {{{ Usage: msgfmt.py [OPTIONS] filename.po Options: ... -d --dump Show all msg_id_NO, msgid and msgstr in filename.po. -p --progress Show translate progress. -r --remaining Show no translated msgid with msg_id_NO. ... }}} == progress option {{{ $ python3 ~/KiCad/kicad-doc/src/translate-set/msgfmt.py --progress ~/KiCad/kicad-doc/src/eeschema/po/ja.po translated: 1151 of 1427 (80%), Remaining: 276 }}} == dump option {{{ $ python3 ~/KiCad/kicad-doc/src/translate-set/msgfmt.py --dump ~/KiCad/kicad-doc/src/eeschema/po/ja.po | head -20 msg_id_NO=1 Eeschema Eeschema msg_id_NO=2 _Reference manual_ _リファレンス・マニュアル_ msg_id_NO=3 *Copyright* *著作権* ... }}} == remaining option {{{ $ python3 ~/KiCad/kicad-doc/src/translate-set/msgfmt.py --remaining ~/KiCad/kicad-doc/src/eeschema/po/ja.po | head -20 msg_id_NO=4 This document is Copyright (C) 2010-2018 by its contributors as listed below. Yo u may distribute it and/or modify it under the terms of either the GNU General Public License (http://www.gnu.org/licenses/gpl.html), version 3 or later, or the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0/), version 3.0 or later. msg_id_NO=12 About KiCad translation: https://github.com/KiCad/kicad-i18n/issues msg_id_NO=14 Published on May 30, 2015. msg_id_NO=15 Symbol Annotation Tool ... }}} -- components: Demos and Tools files: msgfmt.py messages: 314862 nosy: umedoblock priority: normal severity: normal status: open title: add several options to msgfmt.py type: enhancement versions: Python 3.6 Added file: https://bugs.python.org/file47517/msgfmt.py ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33212> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30086] type() and len() recognize "abc", expression as "abc" string.
New submission from umedoblock: But I found a real bug to use a tuple with a comma. Python3 recognized "abc", expression as tuple of one element. But type() and len() recognize "abc", expression as "abc" string. So now, I found a real bug. I'll show you below sentences. >>> "abc", ('abc',) >>> obj = "abc", >>> obj ('abc',) >>> type(obj) >>> len(("abc",)) 1 >>> len(obj) 1 >>> type("abc",) >>> len("abc",) 3 -- components: Regular Expressions messages: 291781 nosy: ezio.melotti, mrabarnett, umedoblock priority: normal severity: normal status: open title: type() and len() recognize "abc", expression as "abc" string. type: behavior versions: Python 3.5 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30086> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30084] starred tuple expression vs list display and function call
umedoblock added the comment: Sorry and thanks to Martin and Steven. I agree with your post about first my post. I understand "(*x) is equivalent to just bare *x." -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30084> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30084] about starred expression
New submission from umedoblock: Hi, all. First of all, my python environment is below. Python 3.5.2+ (default, Sep 22 2016, 12:18:14) [GCC 6.2.0 20160927] on linux = differ evaluation order about starred expression I get below result then I run x.py == File "/home/umedoblock/x.py", line 4 (*(1, 2)) ^ SyntaxError: can't use starred expression here == Next, I comment out line 4 and run Python3. I got below result. And I feel strange behavior above result. Because I think that Python should return same result above and below. == Traceback (most recent call last): File "/home/umedoblock/x.py", line 1, in list(*(1, 2)) TypeError: list() takes at most 1 argument (2 given) == = pass or not about starred expression. list expression pass starred expression, the other hand tuple expression cannot pass starred expression. I hope to pass starred expression about list and tuple. >>> [*(1, 2)] [1, 2] >>> (*(1, 2)) File "", line 1 SyntaxError: can't use starred expression here -- components: Regular Expressions files: x.py messages: 291769 nosy: ezio.melotti, mrabarnett, umedoblock priority: normal severity: normal status: open title: about starred expression type: behavior versions: Python 3.5 Added file: http://bugs.python.org/file46807/x.py ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30084> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24827] round(1.65, 1) return 1.6 with decimal
umedoblock added the comment: last compared results are different. should be bug or at least think that how to get a same result about D(round(df2, 2)) == D(round(ds2, 2)) from decimal import Decimal as D f1 = 1.65 s1 = str(f1) df1 = D(f1) ds1 = D(s1) f2 = 2.675 s2 = str(f2) df2 = D(f2) ds2 = D(s2) f1, df1, ds1 (1.65, Decimal('1.649911182158029987476766109466552734375'), Decimal('1.65')) f2, df2, ds2 (2.675, Decimal('2.67482236431605997495353221893310546875'), Decimal('2.675')) D(round(df1, 1)) == D(round(ds1, 1)) True D(round(df2, 2)) == D(round(ds2, 2)) False -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24827 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24827] round(1.65, 1) return 1.6 with decimal
umedoblock added the comment: In this case. round(1.65, 1) == 1.7 False round(2.675, 2) == 2.68 False I never say anything. Because I understand what you said. But I use the decimal module. please pay attention to use decimal module. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24827 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24827] round(1.65, 1) return 1.6 with decimal
umedoblock added the comment: I have a headache. because python reports many error after I patched below patches. --- Lib/test/test_decimal.py.orig 2015-08-08 17:41:01.986316738 +0900 +++ Lib/test/test_decimal.py2015-08-08 17:41:05.470316878 +0900 @@ -1935,6 +1935,7 @@ ('123.456', 4, '123.4560'), ('123.455', 2, '123.46'), ('123.445', 2, '123.44'), +('1.65', 1, '1.7'), ('Inf', 4, 'NaN'), ('-Inf', -23, 'NaN'), ('sNaN314', 3, 'NaN314'), --- ./Lib/decimal.py.orig 2015-08-08 17:42:20.662319881 +0900 +++ ./Lib/decimal.py2015-08-08 17:39:40.210313472 +0900 @@ -1782,7 +1782,7 @@ def _round_half_even(self, prec): Round 5 to even, rest to nearest. if _exact_half(self._int, prec) and \ -(prec == 0 or self._int[prec-1] in '02468'): +(prec == 0 or self._int[prec-1] in '01234'): return -1 else: return self._round_half_up(prec) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24827 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24827] round(1.65, 1) return 1.6 with decimal
umedoblock added the comment: excuse me. I understand ROUND_HALF_EVEN meaning. I think that __round__() function work ROUND_HALF_UP. so sorry. I don't have exactly knowledge about ROUND_HALF_EVEN. I misunderstand about ROUND_HALF_EVEN. I have thought ROUND_HALF_EVEN means ROUND_HALF_UP. SO SORRY. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24827 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24827] round(1.65, 1) return 1.6 with decimal
New submission from umedoblock: round(1.65, 1) return 1.6 with decimal. I feel bug adobe result. not bug ? import decimal d1 = decimal.Decimal(1.65) d2 = decimal.Decimal(10 ** -2) * 5 d1 Decimal('1.65') d2 Decimal('0.05000104083408559') d1 + d2 Decimal('1.71040834086') data = list(map(decimal.Decimal, 1.05 1.15 1.25 1.35 1.45 1.55 1.65 1.75 1.85 1.95.split())) for x in data: ... print(round({}, 1) = {}.format(x, round(x, 1))) ... round(1.05, 1) = 1.0 round(1.15, 1) = 1.2 round(1.25, 1) = 1.2 round(1.35, 1) = 1.4 round(1.45, 1) = 1.4 round(1.55, 1) = 1.6 round(1.65, 1) = 1.6 round(1.75, 1) = 1.8 round(1.85, 1) = 1.8 round(1.95, 1) = 2.0 round(2.675, 2) 2.67 d4 = decimal.Decimal(2.675) round(d4, 2) Decimal('2.68') -- components: Library (Lib) messages: 248246 nosy: umedoblock priority: normal severity: normal status: open title: round(1.65, 1) return 1.6 with decimal type: behavior versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24827 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24827] round(1.65, 1) return 1.6 with decima modulel
umedoblock added the comment: I don't agree with not a bug. s1, v1, ndigits1 = 1.65, 1.65, 1 s2, v2, ndigits2 = 2.675, 2.675, 2 decimal.Decimal(v1) Decimal('1.649911182158029987476766109466552734375') round(v1, ndigits1) 1.6 round(decimal.Decimal(s1), ndigits1) Decimal('1.6') # EQUAL expression round(v1, ndigits1) decimal.Decimal(v2) Decimal('2.67482236431605997495353221893310546875') round(v2, ndigits2) 2.67 round(decimal.Decimal(s2), ndigits2) Decimal('2.68') # DIFFERENT expression round(v2, ndigits2) decimal module should give me different expression about below. round(decimal.Decimal(s1), ndigits1) and round(v1, ndigits1). BECAUSE round(decimal.Decimal(s2), ndigits2) and round(v2, ndigits2) give me DIFFERENT expression. -- title: round(1.65, 1) return 1.6 with decimal - round(1.65, 1) return 1.6 with decima modulel ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24827 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: how to determine for using c extension or not ?
On 2015年08月04日 00:05, Oscar Benjamin wrote: On Mon, 3 Aug 2015 at 15:58 umedoblock umedobl...@gmail.com mailto:umedobl...@gmail.com wrote: I use bisect.bisect.__module__ sentence to determine for using c extension or not. Why do you want to know if it uses the C extension? It shouldn't really matter. I wrote some C accelerator. I sometimes want to know that python3.x in another machine use C accelerator or not. Because if python3.x doesn't use C acc, I shuold make C acc for another machine. Therefore I'd like to determine for using C acc or not. And I want to know that another machine use C acc or not to use a simple script. But I had felt not good idea about my way to use id(). So I ask this mailing list. -- Oscar -- https://mail.python.org/mailman/listinfo/python-list
Re: how to determine for using c extension or not ?
On 2015年08月04日 03:11, Terry Reedy wrote: Posting three times under two different names is not polite. Please to not repeat. sorry... You should not care. If you think there is an undocumented difference in behavior, ask here if it is a bug. I don't think a bug in this question. I expect that that test/test_bisect.py runs the same tests on both versions. We have a test helper function for such situations. I didn't know test/support.py and support.import_fresh_module() function. I will use this function if I write some C accelerator. thanks. -- https://mail.python.org/mailman/listinfo/python-list
Re: how to determine for using c extension or not ?
normal, no change import bisect bisect.bisect.__module__ '_bisect' I change from from _bisect import * to pass in bisect.py import bisect bisect.bisect.__module__ 'bisect' bisect.bisect.__module__ return different results. they are '_bisect' and 'bisect'. I know that c extension document recomended us to use _ for c extension name prefix. I use bisect.bisect.__module__ sentence to determine for using c extension or not. thanks. On 2015年08月03日 23:11, Joel Goldstick wrote: On Mon, Aug 3, 2015 at 10:01 AM, umedoblock umedobl...@gmail.com wrote: sorry, Joel, Skip, Steven, and python-list members. I think that I don't sent my mail to python-list@python.org or I don't have correct mail setting. so I send many mails. sorry... I should wait a day to get answer, sorry. On 2015年08月03日 22:36, Steven D'Aprano wrote: On Mon, 3 Aug 2015 03:47 pm, umedoblock wrote: Hello everyone. I use bisect module. You asked the same question FOUR times. Have patience. Your question goes all over the world, people may be asleep, or working, or just not know the answer. If you ask a question, and get no answers, you should wait a full day before asking again. bisect module developer give us c extension as _bisect. If Python3.3 use _bisect, _bisect override his functions in bisect.py. So does Python 2.7. now, I use id() function to determine for using c extension or not. The id() function doesn't tell you where objects come from or what language they are written in. But they will tell you if two objects are the same object. import bisect id(bisect.bisect) 139679893708880 import _bisect id(_bisect.bisect) 139679893708880 they return 139679893708880 as id. so i believe that i use c extension. Correct. Also, you can do this: py import bisect py bisect.__file__ '/usr/local/lib/python2.7/bisect.pyc' py bisect.bisect.__module__ # Where does the bisect file come from? '_bisect' py import _bisect py _bisect.__file__ '/usr/local/lib/python2.7/lib-dynload/_bisect.so' So you can see that _bisect is a .so file (on Linux; on Windows it will be a .dll file), which means written in C. -- https://mail.python.org/mailman/listinfo/python-list Welcome to the mailing list, and as I see above, you got a good answer. -- https://mail.python.org/mailman/listinfo/python-list
how to determine for using c extension or not ?
Hello everyone. I use bisect module. bisect module developer give us c extension as _bisect. If Python3.3 use _bisect, _bisect override his functions in bisect.py. now, I use id() function to determine for using c extension or not. import bisect id(bisect.bisect) 139679893708880 import _bisect id(_bisect.bisect) 139679893708880 they return 139679893708880 as id. so i believe that i use c extension. My check is correct ? right ? or you have more good idea ? -- https://mail.python.org/mailman/listinfo/python-list
how to determine for using c extension or not ?
Hello everyone. I use bisect module. bisect module developer give us c extension as _bisect. If Python3.3 use _bisect, _bisect override his functions in bisect.py. now, I use id() function to determine for using c extension or not. import bisect id(bisect.bisect) 139679893708880 import _bisect id(_bisect.bisect) 139679893708880 they return 139679893708880 as id. so i believe that i use c extension. My check is correct ? right ? or you have more good idea ? -- https://mail.python.org/mailman/listinfo/python-list
Re: how to determine for using c extension or not ?
sorry, Joel, Skip, Steven, and python-list members. I think that I don't sent my mail to python-list@python.org or I don't have correct mail setting. so I send many mails. sorry... I should wait a day to get answer, sorry. On 2015年08月03日 22:36, Steven D'Aprano wrote: On Mon, 3 Aug 2015 03:47 pm, umedoblock wrote: Hello everyone. I use bisect module. You asked the same question FOUR times. Have patience. Your question goes all over the world, people may be asleep, or working, or just not know the answer. If you ask a question, and get no answers, you should wait a full day before asking again. bisect module developer give us c extension as _bisect. If Python3.3 use _bisect, _bisect override his functions in bisect.py. So does Python 2.7. now, I use id() function to determine for using c extension or not. The id() function doesn't tell you where objects come from or what language they are written in. But they will tell you if two objects are the same object. import bisect id(bisect.bisect) 139679893708880 import _bisect id(_bisect.bisect) 139679893708880 they return 139679893708880 as id. so i believe that i use c extension. Correct. Also, you can do this: py import bisect py bisect.__file__ '/usr/local/lib/python2.7/bisect.pyc' py bisect.bisect.__module__ # Where does the bisect file come from? '_bisect' py import _bisect py _bisect.__file__ '/usr/local/lib/python2.7/lib-dynload/_bisect.so' So you can see that _bisect is a .so file (on Linux; on Windows it will be a .dll file), which means written in C. -- https://mail.python.org/mailman/listinfo/python-list
how to determine for using c extension or not ?
Hello everyone. I use bisect module. bisect module developer give us c extension as _bisect. If Python3.3 use _bisect, _bisect override his functions in bisect.py. now, I use id() function to determine for using c extension or not. import bisect id(bisect.bisect) 139679893708880 import _bisect id(_bisect.bisect) 139679893708880 they return 139679893708880 as id. so i believe that i use c extension. My check is correct ? right ? or you have more good idea ? -- https://mail.python.org/mailman/listinfo/python-list
[issue17156] Tools/i18n/pygettext.py doesn't parse unicode string.
umedoblock added the comment: python3 output translate Japanese with pygettext.install(). EVERYTHING IS OK! please check to use a konnichiha.2.tar.gz. == please do below shell command. $ for f in `find . -name 'konnichiha.*.py'` ; do echo f=$f ; python3 $f ; echo -- ; done f=./konnichiha.Shift_JIS.py HELLO ハローで、今日は 日本語をUTF8にしてコンニチハ -- f=./konnichiha.UTF-8.py HELLO ハローで、今日は 日本語をUTF8にしてコンニチハ -- f=./konnichiha.ISO-2022-JP.py HELLO ハローで、今日は 日本語をUTF8にしてコンニチハ -- f=./konnichiha.EUC-JP.py HELLO ハローで、今日は 日本語をUTF8にしてコンニチハ -- == konnichiha script encoding is OK! $ nkf -g ./konnichiha.*.py ./konnichiha.EUC-JP.py: EUC-JP ./konnichiha.ISO-2022-JP.py: ISO-2022-JP ./konnichiha.Shift_JIS.py: Shift_JIS ./konnichiha.UTF-8.py: UTF-8 == also coding: is OK! $ head -2 konnichiha.*.py == konnichiha.EUC-JP.py == # coding: euc-jp import gettext == konnichiha.ISO-2022-JP.py == # coding: iso-2022-jp import gettext == konnichiha.Shift_JIS.py == # coding: shift-jis import gettext == konnichiha.UTF-8.py == # coding: utf-8 import gettext == THANK YOU serhiy.storchaka ! -- Added file: http://bugs.python.org/file29018/konnichiha.2.tar.gz ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17156 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17156] Tools/i18n/pygettext.py doesn't parse unicode string.
umedoblock added the comment: thanks serhiy.storchaka. I try to use Shift_JIS, UTF-8, ISO-2022-JP and EUC-JP. your patch detects UTF-8. However it doesn't detect Shift_JIS, ISO-2022-JP and EUC-JP. it misunderstand ISO-2022-JP charset is UTF-8. it raised UnicodeDecodeError when Shift_JIS, EUC-JP. Please check my test to use konnichiha.sh. -- Added file: http://bugs.python.org/file29009/konnichiha.tar.gz ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17156 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17156] Tools/i18n/pygettext.py doesn't parse unicode string.
umedoblock added the comment: I use just a pygettext_unicode.patch. don't use a pygettext_unicode-2.7.patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17156 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17156] Tools/i18n/pygettext.py doesn't parse unicode string.
New submission from umedoblock: I'd like to parse _('こんにちは'). However pygettext.py doesn't parse _('こんにちは'). pygettext.py said me 'IndexError'. now I attached pygettext.py.patch to fix a bug. I show you command history. $ pygettext.py -o - --verbose konnichiha.py ... #: konnichiha.py:6 msgid konnichiha msgstr #: konnichiha.py:7 Traceback (most recent call last): File /home/umetaro/local/bin/pygettext.py, line 664, in module main() File /home/umetaro/local/bin/pygettext.py, line 657, in main eater.write(fp) File /home/umetaro/local/bin/pygettext.py, line 497, in write print('msgid', normalize(k), file=fp) File /home/umetaro/local/bin/pygettext.py, line 250, in normalize s = '' + escape(s) + '' File /home/umetaro/local/bin/pygettext.py, line 236, in escape s[i] = escapes[ord(s[i])] IndexError: list index out of range please use pygettext.py.patch. $ pygettext.py -o - --verbose konnichiha.py ... #: konnichiha.py:6 msgid konnichiha msgstr #: konnichiha.py:7 msgid こんにちは msgstr -- components: Demos and Tools files: konnichiha.py messages: 181651 nosy: umedoblock priority: normal severity: normal status: open title: Tools/i18n/pygettext.py doesn't parse unicode string. type: behavior versions: Python 3.2 Added file: http://bugs.python.org/file28991/konnichiha.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17156 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17156] Tools/i18n/pygettext.py doesn't parse unicode string.
Changes by umedoblock umedobl...@gmail.com: -- keywords: +patch Added file: http://bugs.python.org/file28992/pygettext.py.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17156 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17156] Tools/i18n/pygettext.py doesn't parse unicode string.
umedoblock added the comment: TOO SORRY. pygettext.py.patch umedoblock, 2013-02-08 10:32 is wrong a patch. please forget it. -- Added file: http://bugs.python.org/file28993/pygettext.py.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17156 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15644] after _bytesio.seek(0), _bytesio.getvalue() returned reversed data.
umedoblock added the comment: thanks Ned. I understood your comment. I'm happy! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15644 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15644] after _bytesio.seek(0), _bytesio.getvalue() returned reversed data.
New submission from umedoblock: import io _bytesio = io.BytesIO() _bytesio.write(b'abc') _bytesio.write(b'def') _bytesio.seek(0) _bytesio.write(b'xyz') print(_bytesio.read(2)) print(_bytesio.read(2)) print(_bytesio.getvalue()) # output b'de' b'f' b'xyzdef' # where is the b'abc' ? -- components: IO messages: 168174 nosy: umedoblock priority: normal severity: normal status: open title: after _bytesio.seek(0), _bytesio.getvalue() returned reversed data. type: behavior versions: Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15644 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10614] ZipFile: add a filename_encoding argument
umedoblock umedobl...@gmail.com added the comment: Hi, Martin. I tried your test case with attached file. And I got below result. p3 ./encodings.py encoding: sjis, filename: f馬 encoding: cp437, filename: fön sjis_filename = f馬 cp437_filename = fön There are two success cases. So I think that the patch needs to change default_encoding before or in _decode_filename(). But I have no idea about how to change a default_encoding. -- Added file: http://bugs.python.org/file26376/encodings.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10614 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10614] ZipFile: add a filename_encoding argument
umedoblock umedobl...@gmail.com added the comment: I fixed this problem. I make new methos _decode_filename(). -- keywords: +patch nosy: +umedoblock Added file: http://bugs.python.org/file26372/zipfile.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10614 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13971] format() doesn't parse str.
New submission from umedoblock umedobl...@gmail.com: format() mis understaning. please pay attention to [0], [x]. d = {0: a, 0: A} 'd[0] = {0[0]}'.format(d) 'd[0] = a' 'd[0] = {0[0]}'.format(d) Traceback (most recent call last): File stdin, line 1, in module KeyError: '0' d2 = {x: 100} 'd2[x] = {0[x]}'.format(d2) 'd2[x] = 100' -- components: Regular Expressions messages: 152897 nosy: ezio.melotti, umedoblock priority: normal severity: normal status: open title: format() doesn't parse str. type: behavior versions: Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
How do I call super() in c extention ?
Hi, nice to meet you, everyone. I'm umedoblock. I'd like to call super() in c extension. I'd like to rewrite class Baa as c extension. Please see below code. Now, I can make super object. But I cannot understand how to use super_init(), super_descr_get() and super_getattro(). Please please help me... baa.py class Baa(object): def __init__(self): print('call __init__() in Baa.') def sample(self): print('call sample() in Baa.') class Foo(Baa): def __init__(self): print('call __init__() in Foo.') super().sample() super().__init__() class Baz(Foo): def __init__(self): print('call __init__() in Baz.') super().__init__() -- pyfoo.c static int Foo_init(FooObject *self, PyObject *args, PyObject *kwds) { int ret = 0; PyTypeObject *super_type = PySuper_Type; PyObject *super_obj; PyObject *empty_tuple; super_obj = super_type-tp_alloc(super_type, 0); empty_tuple = Py_BuildValue(()); ret = super_type-tp_init(super_obj, empty_tuple, NULL); fprintf(stderr, super_obj = %p\n, super_obj); PyObject_Print((PyObject *)super_obj, stderr, 0); fprintf(stderr, \n\n); fprintf(stderr, super_type-tp_init(super_obj=%p, empty_tuple=%p, NULL)=%d\n, super_obj, empty_tuple, ret); return 0; } PyMODINIT_FUNC PyInit__foo(void) { PyObject *m; PyObject *import_baa = NULL, *Baa = NULL; PyObject *Baa_str; import_baa = PyImport_ImportModule(baa); Baa_str = Py_BuildValue(s, Baa); Baa = PyObject_GetAttr(import_baa, Baa_str); Foo_Type.tp_base = (struct _typeobject *)Baa; Py_INCREF(Foo_Type.tp_base); Foo_Type.tp_new = Foo_new; if (PyType_Ready(Foo_Type) 0) return NULL; Py_INCREF(Foo_Type); m = PyModule_Create(Foo_module); if (m == NULL) return NULL; PyModule_AddObject(m, Foo, (PyObject *)Foo_Type); PyModule_AddStringConstant(m, CONST, C_EXTENSION); return m; } -- http://mail.python.org/mailman/listinfo/python-list
[issue12211] Better document math.copysign behavior.
umedoblock umedobl...@gmail.com added the comment: sandro: OK, I attached the new patch. -- Added file: http://bugs.python.org/file22480/issue_12211_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12211] Better document math.copysign behavior.
umedoblock umedobl...@gmail.com added the comment: I'm late, sorry. I attached the patch for math.rst and mathmodule.c. -- Added file: http://bugs.python.org/file22278/issue_12211.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12211] math.copysign must keep object type.
umedoblock umedobl...@gmail.com added the comment: abs() behavior show below. type(abs(-1)) class 'int' type(abs(-1.0)) class 'float' we should fix this problem if write Return abs(x) with the sign of y I'd like to try this problem if need fix. I'm going to attach the patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12211] math.copysign must keep object type.
umedoblock umedobl...@gmail.com added the comment: I made the patch. But it cannot pass testCopysign(). math.copysign(1, -0.) returns 1. I hope to return -1. But I don't know how to realize -0. as negative value. Please help me. -- components: +Library (Lib) -Documentation keywords: +patch versions: -Python 2.7, Python 3.3 Added file: http://bugs.python.org/file22249/math_copysign.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12211] math.copysign must keep object type.
Changes by umedoblock umedobl...@gmail.com: Removed file: http://bugs.python.org/file22249/math_copysign.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12211] math.copysign must keep object type.
Changes by umedoblock umedobl...@gmail.com: Added file: http://bugs.python.org/file22250/math_copysign.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12211] math.copysign must keep object type.
Changes by umedoblock umedobl...@gmail.com: Removed file: http://bugs.python.org/file22250/math_copysign.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12211] math.copysign must keep object type.
umedoblock umedobl...@gmail.com added the comment: sorry. I fix my bug. but this patch contain new fail... math.copysign(-1., 0.) returns 1. -- Added file: http://bugs.python.org/file22251/math_copysign.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12211] math.copysign must keep object type.
umedoblock umedobl...@gmail.com added the comment: I attached DOC patch. I misunderstand ? Sorry... I think that go ahead and make one means I shuold make the source patch. I use just Python3.2. I didn't use Python 2.x, 3.0 and 3.1 in my programming life. Therefore I reported version 3.2. I should the versions to 3rd party ? -- Added file: http://bugs.python.org/file22254/math.rst.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12211] math.copysign must keep object type.
New submission from umedoblock umedobl...@gmail.com: I expected return int if I gave x as integer to copysign. I encounterd two problems. I'd like to fix this problems. but I can't come up with nice idea. therefore I just report for you. one: import math a = [0, 1, 2, 3] i = 1 i_copysign = math.copysign(i, -1) a[i_copysign] Traceback (most recent call last): File stdin, line 1, in module TypeError: list indices must be integers, not float two: n = 10 ** 20 math.copysign(n + 1, 1) == n + 1 False -- components: Library (Lib) messages: 137226 nosy: umedoblock priority: normal severity: normal status: open title: math.copysign must keep object type. type: behavior versions: Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11746] ssl library load_cert_chain cannot use elliptic curve type private key
New submission from umedoblock umedobl...@gmail.com: ssl library load_cert_chain cannot use elliptic curve type private key. I resolved the problem, I attached patch file -- components: Library (Lib) files: _ssl.c.diff keywords: patch messages: 132830 nosy: umedoblock priority: normal severity: normal status: open title: ssl library load_cert_chain cannot use elliptic curve type private key versions: Python 3.2 Added file: http://bugs.python.org/file21513/_ssl.c.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11746 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com