Hi !
I have one small program that should be completed till tomorrow so if
someone can help am ready to pay this ( btw. budget for this is $40 ).
Project:
- usb scanner is connected to the PI.
- when the user gets his e.g. coffe bill with barcode, he put this bill
in from of scanner and
Arfrever Frehtes Taifersar Arahesis added the comment:
test_excinfo_no_python_sourcecode of py now passes.
--
resolution: - fixed
stage: - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21591
Dirkjan Ochtman added the comment:
Thanks, Benjamin, for reverting the run-time bits.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21591
___
Nick Coghlan added the comment:
Given that our test suite missed the regression originally, it would be
nice to have a test case that directly built an AST that relies on the
runtime check.
--
___
Python tracker rep...@bugs.python.org
Dirkjan Ochtman added the comment:
I can take a look at the py failure next week.
Keeping the run-time compatibility code seems sensible, but I'm not sure if
it'd fix the py test?
I don't think reverting the changes at this point is warranted.
--
Nick Coghlan added the comment:
Agreed reverting isn't necessary - main thing is to figure out what went wrong
in the py test suite and come up with a new test case that covers it.
The reason I suspect it's the missing runtime check that's causing the py
problem is because (as far as I am
Roundup Robot added the comment:
New changeset 0e9b023078e6 by Benjamin Peterson in branch '2.7':
restore runtime exec test (#21591)
http://hg.python.org/cpython/rev/0e9b023078e6
--
___
Python tracker rep...@bugs.python.org
Arfrever Frehtes Taifersar Arahesis added the comment:
Commit 33fb5600e9a1 causes 1 test failure in test suite of py
(https://pypi.python.org/pypi/py).
Test suite of py requires pytest (https://pypi.python.org/pypi/pytest)
The failing test (test_excinfo_no_python_sourcecode) requires Jinja
Nick Coghlan added the comment:
I suspect there may also be a problem if executing pyc code generated the old
way (this patch didn't bump the magic number, and doesn't really need to, so
that case still needs to be handled).
Restoring the runtime check should cover it (the test can craft a
Changes by Berker Peksag berker.pek...@gmail.com:
--
stage: patch review - resolved
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21591
___
___
Roundup Robot added the comment:
New changeset 33fb5600e9a1 by Dirkjan Ochtman in branch '2.7':
Issue #21591: Handle exec backwards compatibility in the AST builder.
http://hg.python.org/cpython/rev/33fb5600e9a1
New changeset 6c47c6d2033e by Robert Jordens in branch '2.7':
Issue #21591: add
Dirkjan Ochtman added the comment:
Thanks to Victor Stinner for the review!
--
resolution: - fixed
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21591
___
Changes by STINNER Victor victor.stin...@gmail.com:
--
nosy: +haypo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21591
___
___
Python-bugs-list
Dirkjan Ochtman added the comment:
I came up with a patch that shifts the compatibility hack we have for the tuple
form of exec from run-time (in exec_statement()) to the CST-to-AST
transformation (in ast_for_exec_stmt()). It seems to pass the tests (including
the ones Robert pasted in here).
Dirkjan Ochtman added the comment:
Oh, one specific question: I'm not sure if I should free the old expr1 (the
top-level exec value) before overwriting it with the new one.
--
___
Python tracker rep...@bugs.python.org
Changes by Dirkjan Ochtman dirk...@ochtman.nl:
--
nosy: +djc
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21591
___
___
Python-bugs-list mailing
Guido van Rossum added the comment:
This does appear to be a bug. Please research the C code that originates the
error message -- there's probably a simple logic mistake.
--
nosy: +gvanrossum
___
Python tracker rep...@bugs.python.org
Neil Muller added the comment:
Poking at the source of the error suggests the problem is in symtable.c:
The offending logic looks to be (around line 1124 in python 2.7 at revision
91767:4cef7b0ec659):
if (s-v.Exec.globals) {
...
}
else
{
st-st_cur-ste_unoptimized |= OPT_BARE_EXEC;
}
Steve Dower added the comment:
With 2.7 and 3.4 (same for 32- and 64-bit):
f = open('test.bin', 'wb')
f.write(b' ' * (1024*1024*100))
104857600
f.close()
import os
os.stat('test.bin').st_size
104857600
The linked KB only applies to VS 2003 and VS 2005 (VC7 and VC8), so I'm not
entirely
Mark Lawrence added the comment:
@Jason I'm very sorry about the delay in getting back to you.
Can our Windows gurus shed any light on this one?
--
nosy: +BreamoreBoy, steve.dower, tim.golden, zach.ware
type: - behavior
versions: +Python 3.4, Python 3.5
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:
--
nosy: +Arfrever
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11681
___
Emily Zhao added the comment:
Might be worth making this addition from 3 (I'm not sure how to add this to 2)
-b : issue warnings about str(bytes_instance), str(bytearray_instance)
and comparing bytes/bytearray with str. (-bb: issue errors)
Building on Martin's example:
On all
Emily Zhao added the comment:
Here's an attempt (based on 3's main.c
http://hg.python.org/cpython/file/8866ac6f2269/Modules/main.c)
--
keywords: +patch
Added file: http://bugs.python.org/file35528/issue11681.patch
___
Python tracker
Martin Panter added the comment:
Trouble is, in Python 2 bytes() and str() are the same thing, and most of those
conditions don’t apply. Maybe something like this is more correct:
-b : issue warnings about comparing bytearray with unicode.
(-bb: issue errors
Changes by Serhiy Storchaka storch...@gmail.com:
--
stage: patch review - needs patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20361
___
___
Terry J. Reedy added the comment:
The exception appears to be intentional, though I do not know what a
'qualified' exec would be. But since the tuple form is intended to mimic 3.x
exec, and since a reduced version of your example
c = '''
def g():
def f():
if True:
New submission from Robert Jordens:
According to the documentation the exec a in b, c is equivalent to exec(a,
b, c). But in the testcase below the tuple form causes a SyntaxError while the
statement form works fine.
diff -r e770d8c4291c Lib/test/test_compile.py
--- a/Lib/test
Antoine Pitrou added the comment:
The patch is a bit problematic, because Py_BytesWarningFlag may also be set by
e.g. an application embedding Python, but then Python's main.c won't be
executed.
--
___
Python tracker rep...@bugs.python.org
Raymond Hettinger added the comment:
Serhiy, Gregory, Raymond, Antoine: so what is your feeling on
this issue? Is it worth it?
I don't think it is worth it. There may be some cases that benefit, but it
adds extra branching code to the common cases (sets and dicts) that already
have the
Roundup Robot added the comment:
New changeset dc6c2ab7fec2 by Mark Dickinson in branch 'default':
Issue #21193: Make (e.g.,) pow(2, -3, 5) raise ValueError rather than
TypeError. Patch by Josh Rosenberg.
http://hg.python.org/cpython/rev/dc6c2ab7fec2
--
nosy: +python-dev
Mark Dickinson added the comment:
Patch applied. Thanks, all.
--
resolution: - fixed
stage: - committed/rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21193
Roundup Robot added the comment:
New changeset a8f3ca72f703 by Benjamin Peterson in branch 'default':
test the change of #21193 correctly
http://hg.python.org/cpython/rev/a8f3ca72f703
--
___
Python tracker rep...@bugs.python.org
Mark Dickinson added the comment:
Benjamin: thanks for the fix. To be clear: Josh Rosenberg's patch had the
correct test change. It was the (poorly) trained monkey who made the commit
who broke the test.
Sorry, all.
--
___
Python tracker
Rustom Mody wrote:
def fl1(l): return [y for x in l for y in x]
# recursive flatten
def fr(l):
... if not isinstance(l,list): return [l]
... return fl1([fr(x) for x in l])
For a short non-recursive procedure - not a function, modifies L in-place but
none of its sublists.
def
Boris Borcic wrote:
Rustom Mody wrote:
def fl1(l): return [y for x in l for y in x]
# recursive flatten
def fr(l):
... if not isinstance(l,list): return [l]
... return fl1([fr(x) for x in l])
For a short non-recursive procedure - not a function, modifies L in-place but
none of its
wrote:
x=[a,b,[c,d],e]
y=x[2]
y
['c', 'd']
x.insert(2,y[0])
x
['a', 'b', 'c', ['c', 'd'], 'e']
x.insert(3,y[1])
x
['a', 'b', 'c', 'd', ['c', 'd'], 'e']
del x[4]
x
['a', 'b', 'c', 'd', 'e']
maybe there is a more smart way to do.
--
https://mail.python.org/mailman/listinfo
Changes by Mark Dickinson dicki...@gmail.com:
--
assignee: - mark.dickinson
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21193
___
___
Mark Dickinson added the comment:
I was wondering how the TypeError got there in the first place. Diving into
the history is instructive: changeset cdfdd5359411 modified the exception
message:
taniyama:cpython mdickinson$ hg log -r19719
changeset: 19719:cdfdd5359411
branch:
Josh Rosenberg added the comment:
Agreed that there is no need to patch 2.7/3.4; this is a pedantic correctness
fix, not a serious bug.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21193
Antoine Pitrou added the comment:
+1 for ValueError as well.
--
nosy: +pitrou
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21193
___
___
Tim Peters added the comment:
Yup, agreed with all: ValueError makes a lot more sense, but the change
shouldn't be backported.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21193
___
x=[a,b,[c,d],e]
y=x[2]
y
['c', 'd']
x.insert(2,y[0])
x
['a', 'b', 'c', ['c', 'd'], 'e']
x.insert(3,y[1])
x
['a', 'b', 'c', 'd', ['c', 'd'], 'e']
del x[4]
x
['a', 'b', 'c', 'd', 'e']
maybe there is a more smart way to do.
--
https://mail.python.org/mailman/listinfo/python-list
length power elearn2...@gmail.com writes:
maybe there is a more smart way to do.
Maybe. But a way to do what, exactly?
You start with a list, but what is it exactly that you want to do with
that list?
x = [a, b, [c, d], e]
If I interpret your request *literally*, I can achieve
There was long thread discussing flattening of a list on this list :).
See the link below.
https://mail.python.org/pipermail/python-list/2014-March/669256.html
On 10 April 2014 10:44, length power elearn2...@gmail.com wrote:
x=[a,b,[c,d],e]
y=x[2]
y
['c', 'd']
x.insert(2,y[0])
x
['a', 'b
On Thursday, April 10, 2014 10:55:10 AM UTC+5:30, balaji marisetti wrote:
There was long thread discussing flattening of a list on this list :).
See the link below.
I dont think that thread is relevant to this question:
1. That (started with) a strange/cute way of using names
2. It does not
rely on this behavior.
Related: #457066
--
components: Interpreter Core
messages: 215860
nosy: josh.rosenberg
priority: normal
severity: normal
status: open
title: pow(a, b, c) should not raise TypeError when b is negative and c is
provided
type: behavior
versions: Python 2.7, Python 3.1
Changes by Ned Deily n...@acm.org:
--
nosy: +mark.dickinson
versions: -Python 3.1, Python 3.2, Python 3.3
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21193
___
Josh Rosenberg added the comment:
Here's the trivial patch for code and the associated unit test (we were
actually testing that it raised TypeError specifically; it now raises
ValueError, and the unit test expects ValueError).
unit tests passed aside from test_io, but I'm pretty sure that's
Josh Rosenberg added the comment:
As I mentioned on another bug, I filled out and submitted the contributor
agreement form electronically earlier this week, it just hasn't propagated yet.
I'm fairly sure trained monkeys reading the description of this bug report
would produce the exact same
Changes by Stefan Krah stefan-use...@bytereef.org:
--
nosy: -skrah
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20361
___
___
Python-bugs-list
Serhiy Storchaka added the comment:
Final patch should remove a workaround in Tools/scripts/run_tests.py.
--
nosy: +serhiy.storchaka
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20361
___
Changes by Ezio Melotti ezio.melo...@gmail.com:
--
nosy: +ezio.melotti
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20361
___
___
Changes by Jakub Wilk jw...@jwilk.net:
--
nosy: +jwilk
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20361
___
___
Python-bugs-list mailing list
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:
--
versions: +Python 3.5 -Python 3.4
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20361
___
Changes by Mark Lawrence breamore...@yahoo.co.uk:
--
nosy: -BreamoreBoy
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7938
___
___
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:
--
stage: - patch review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20361
___
New submission from Arfrever Frehtes Taifersar Arahesis:
Currently -W command line options and PYTHONWARNINGS environmental variable
non-intuitively override settings specified by -b / -bb command line options.
$ python3.4 -c 'print( == b)'
False
$ python3.4 -b -c 'print( == b)'
-c:1
Arfrever Frehtes Taifersar Arahesis added the comment:
By the way, Tools/scripts/run_tests.py (used by 'test' target in Makefile)
passes '-W default -bb', which currently fails work as intended (i.e. treating
BytesWarnings as errors).
--
___
Python
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:
--
dependencies: +BytesWarnings triggerred by test suite
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20361
___
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:
--
resolution: - invalid
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20340
___
New submission from Arfrever Frehtes Taifersar Arahesis:
-bb option does not have different behavior than -b option since Python 3.2.
http://docs.python.org/3.4/using/cmdline.html#cmdoption-b says:
Issue a warning when comparing str and bytes. Issue an error when the option
is given twice (-bb
Changes by moijes12 moije...@gmail.com:
--
nosy: -moijes12
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11681
___
___
Python-bugs-list mailing
Martin Panter added the comment:
Try this to trigger a warning:
python2 -b -c 'bytearray(3) == u3'
-c:1: BytesWarning: Comparison between bytearray and string
--
nosy: +vadmium
___
Python tracker rep...@bugs.python.org
http://bugs.python.org
STINNER Victor added the comment:
If it's hard to see a real speedup, it's probably not interesting to use the
hash in string comparison.
--
resolution: - invalid
status: open - closed
___
Python tracker rep...@bugs.python.org
STINNER Victor added the comment:
I ran pybench with the patch. I don't understand this result (10% slower with
the patch):
DictWithStringKeys:28ms25ms +10.7%28ms26ms +10.5%
This test doesn't use unicode_compare_eq() from Objects/unicodeobject.c but
unicode_eq() from
STINNER Victor added the comment:
(oops, I didn't want to close the issue, it's a mistake)
--
resolution: invalid -
status: closed - open
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16286
STINNER Victor added the comment:
I added recently a new _PyUnicode_CompareWithId() function: changeset
77bebcf5c4cf (issue #19512).
This function can be used instead of PyUnicode_CompareWithASCIIString() when
the right parameter is a common string. It is interesting when the right string
is
STINNER Victor added the comment:
Serhiy, Gregory, Raymond, Antoine: so what is your feeling on this issue? Is it
worth it?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16286
___
Roundup Robot added the comment:
New changeset 536a7c09c7fd by Victor Stinner in branch 'default':
Issue #16286: write a new subfunction bytes_compare_eq()
http://hg.python.org/cpython/rev/536a7c09c7fd
--
nosy: +python-dev
___
Python tracker
Roundup Robot added the comment:
New changeset 5fa291435740 by Victor Stinner in branch 'default':
Issue #16286: optimize PyUnicode_RichCompare() for identical strings (same
http://hg.python.org/cpython/rev/5fa291435740
--
___
Python tracker
Roundup Robot added the comment:
New changeset da9c6e4ef301 by Victor Stinner in branch 'default':
Issue #16286: remove duplicated identity check from unicode_compare()
http://hg.python.org/cpython/rev/da9c6e4ef301
--
___
Python tracker
STINNER Victor added the comment:
I applied changes unrelated to the hash.
--
Added file: http://bugs.python.org/file32493/compare_hash-3.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16286
STINNER Victor added the comment:
Results of benchmarks using compare_hash-3.patch:
$ time ../benchmarks/perf.py -r -b default ./pythonorig ./pythonhash
INFO:root:Skipping benchmark slowspitfire; not compatible with Python 3.4
INFO:root:Skipping benchmark slowpickle; not compatible with Python
STINNER Victor added the comment:
Updated patch.
--
Added file: http://bugs.python.org/file32445/compare_hash-2.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16286
___
Antoine Pitrou added the comment:
That raises the question of what strings ever have had their hash
already computed if the string hasn't been interned or has been used
in a dict or set?
Currently, none, I think.
--
nosy: +pitrou
___
Python
STINNER Victor added the comment:
That raises the question of what strings ever have had their hash
already computed if the string hasn't been interned or has been used
in a dict or set?
Currently, none, I think.
Strings are used (and compared) outside dict and set.
--
STINNER Victor added the comment:
Let's try to identify some use cases in the Python test suite using gdb:
(gdb) b unicode_compare_eq
(gdb) condition 1 ((PyASCIIObject*)str1)-hash != -1
((PyASCIIObject*)str2)-hash != -1 ((PyASCIIObject*)str1)-hash !=
((PyASCIIObject*)str2)-hash
(gdb) run
STINNER Victor added the comment:
(4) str in __all__ (list of str):
os.py:
if putenv not in __all__:
__all__.append(putenv)
For this example: putenv is probably interned by def putenv(...). putenv
string and the name of the function are the same constant. When a function is
Michele Orrù added the comment:
ping.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8425
___
___
Python-bugs-list mailing list
Unsubscribe:
Raymond Hettinger added the comment:
There's no rush on this. I have other work I want to do on set objects before
applying further optimizations, so I want to hold off on it for a bit.
--
___
Python tracker rep...@bugs.python.org
New submission from Jakub Wilk:
The -b and -X options are not documented in Misc/python.man.
--
assignee: docs@python
components: Documentation
messages: 191463
nosy: docs@python, jwilk
priority: normal
severity: normal
status: open
title: python.man: no documentation for -b, -X
R. David Murray added the comment:
I think we tend to forget that that page exists.
Patches welcome.
--
keywords: +easy
nosy: +r.david.murray
stage: - needs patch
type: - behavior
___
Python tracker rep...@bugs.python.org
Corey Brune added the comment:
Hello,
I added the two options requested in python.man in the patch file created from
hg diff python.man.patch.
--
keywords: +patch
nosy: +cbrune
Added file: http://bugs.python.org/file30649/python.man.patch
___
Senthil Kumaran added the comment:
Thanks for the patch. Committed these changes in:
changeset dfead0696a71
changeset e26b00adb7ba
--
nosy: +orsenthil
resolution: - fixed
stage: needs patch - committed/rejected
status: open - closed
versions: +Python 3.3, Python 3.4
Hello,
Let's say I want to compare two csv files: file A and file B. They are both
similarly built - the first column has product IDs (one product per row) and
the columns provide some stats about the products such as sales in # and $.
I want to compare these files - see which product IDs
Alan Newbie wrote:
Hello,
Let's say I want to compare two csv files: file A and file B. They are
both similarly built - the first column has product IDs (one product per
row) and the columns provide some stats about the products such as sales
in # and $.
I want to compare these files
(Bfile.csv, rb) as g:
b = {row[0] for row in csv.reader(g)}
#create variables pointing to lists with unique product IDs in A and B
respectively
in_a_not_b = a-b
in_b_not_a = b-a
print in_a_not_b
print in_b_not_a
with open(inAnotB.csv, wb) as f:
writer = csv.writer(f
alonn...@gmail.com wrote:
and when I run it I get an invalid syntex error and (as a true newbie
I used a GUI)in_a_not_b is highlighted in the with open(inAnotB.csv,
wb) as f:
writer = csv.writer(f)
writer.writerows([item] for item in_a_not_b)
thanks a lot :)
--
http://mail.python.org/mailman/listinfo/python-list
to get it exactly the string I wanted. I wanted,
for example, b'\n\x00' to display as 0x0A 0x00 or b'!\xff(\xc0' to
display as 0x21 0xFF 0x28 0xC0.
a = b'!\xff(\xc0\n\x00'
z = ['0x{:02X}'.format(c) for c in b]
z
['0x21', '0xFF', '0x28', '0xC0', '0x0A', '0x00']
s = ' '.join(z)
s
, for
example, b'\n\x00' to display as 0x0A 0x00 or b'!\xff(\xc0' to display as
0x21 0xFF 0x28 0xC0.
--
http://mail.python.org/mailman/listinfo/python-list
This notation displays hex values except when they are 'printable', in which
case it displays that printable character. How do I get it to force hex for
all bytes? Thanks, Steve
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, May 29, 2013 at 12:33 PM, alcyon st...@terrafirma.us wrote:
This notation displays hex values except when they are 'printable', in which
case it displays that printable character. How do I get it to force hex for
all bytes? Thanks, Steve
Is this what you want?
''.join('%02x' % x
On 29May2013 13:14, Ian Kelly ian.g.ke...@gmail.com wrote:
| On Wed, May 29, 2013 at 12:33 PM, alcyon st...@terrafirma.us wrote:
| This notation displays hex values except when they are 'printable', in
which case it displays that printable character. How do I get it to force hex
for all bytes?
that uses
mode 'wb') to use mode 'w+b', at least on Windows.
--
components: Library (Lib)
messages: 189624
nosy: Jason.Gross
priority: normal
severity: normal
status: open
title: subprocess should open stdin in mode w+b on windows
versions: Python 2.7
STINNER Victor added the comment:
I will benchmark the overhead of memcmp() on short strings. We may
check the first and last characters before calling memcmp() to limit
the overhead of calling a function.
I created the issue #17628 for this point.
--
Changes by STINNER Victor victor.stin...@gmail.com:
--
title: Optimize a==b and a!=b for bytes and str - Use hash if available to
optimize a==b and a!=b for bytes and str
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16286
Georg Brandl added the comment:
Can this be closed?
--
nosy: +georg.brandl
status: pending - open
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12119
___
Éric Araujo added the comment:
In the absence of support for doing the right thing (which would break
compatibility), I won’t change distutils here.
--
stage: commit review - committed/rejected
status: open - closed
___
Python tracker
sorin added the comment:
Can we have a fix for this? ... one that would not require me to drop using
PYTHONDONTWRITEBYTECODE.
I do have PYTHONDONTWRITEBYTECODE=1 on my user profile and installing packages
became a nightmare.
--
nosy: +sorin
___
501 - 600 of 1624 matches
Mail list logo