Changes by Kristján Valur Jónsson :
--
resolution: -> fixed
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue14288>
___
___
Pyth
Kristján Valur Jónsson added the comment:
possibly, multiprocessing.Connection uses handles, which can be socket handles
on windows, and that code also uses DuplicateHandle. I think a generic
solution must be found for multiprocessing, so I'll create a separate
Kristján Valur Jónsson added the comment:
Here is a new patch.
1) I´ve simplified and relaxed test_notify() for Condition objects. Condition
variables don't guarantee that there won't be any spurious wakeups so the test
must maintain internal bookkeeping so that it doesn'
Changes by Kristján Valur Jónsson :
--
nosy: +kristjan.jonsson
___
Python tracker
<http://bugs.python.org/issue4892>
___
___
Python-bugs-list mailing list
Unsub
Kristján Valur Jónsson added the comment:
I just want to point out that each time socket.share() is called, the resulting
data can only be used once by socket.fromshare(). I'm mentioning this because
I know there is some caching mechanism in reduction.py and that this data is
not cach
Kristján Valur Jónsson added the comment:
We shouldn't be testing implementation details. The Condition variables are
canonically prone to "spurious wakeups" and "stolen wakeups". The fact that
the current implementation doesn't have them shouldn&
Kristján Valur Jónsson added the comment:
Stolen wakeups are a fact of life though, even in cpython's implementation of
condition variables. And for the user of a condition variable the difference
is so subtle as to not warrant special mention.
This is, btw, not just a posix thing.
Kristján Valur Jónsson added the comment:
A few comments:
1)
with cv:
make_an_item_available()
+ cv.notify()
2) one of the benefits of wait_for() is that it automates the tricky
timekeeping needed if one wants an somewhat accurate timeout, you may want to
mention this
Kristján Valur Jónsson added the comment:
> But, once again, "the condition may not yet hold true" is false.
In our current implementation, yes. But it is intentionally left undefined in
the specification of the condition variable protocol, for very good reasons.
While I
Changes by Kristján Valur Jónsson :
--
nosy: +kristjan.jonsson
___
Python tracker
<http://bugs.python.org/issue11750>
___
___
Python-bugs-list mailing list
Unsub
Changes by Kristján Valur Jónsson :
--
nosy: +kristjan.jonsson
___
Python tracker
<http://bugs.python.org/issue14574>
___
___
Python-bugs-list mailing list
Unsub
Kristján Valur Jónsson added the comment:
+1, we already have such decorators for individual test cases. Code should be
obvious, particularly testing code and mixins often aren't. Magic such as
identifying classes to run by their type should be over rideable. All magic
s
Kristján Valur Jónsson added the comment:
It shouldn't. I noticed this and fixed this at CCP a while back but I wasn't in
Python Committer mode at the time. _select needs fixing.
--
___
Python tracker
<http://bugs.python.o
Kristján Valur Jónsson added the comment:
You are creating a 10 level nested structure of iterators. It is no wonder
that you exhaust the stack space of the interpreter. You would get the same
with any iterator combination, nothing special with zip and starmap here.
I can't see
Kristján Valur Jónsson added the comment:
(fixed wsock32.lib in revision ab0aff639cfb)
--
___
Python tracker
<http://bugs.python.org/issue11750>
___
___
Pytho
Kristján Valur Jónsson added the comment:
I think this needs serious consideration. There needs to be an "socket error"
case cleanup path that releases resources but ignores further socket errors.
--
___
Python tracker
<http://bu
Changes by Kristján Valur Jónsson :
--
resolution: -> fixed
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue10576>
___
___
Pyth
Kristján Valur Jónsson added the comment:
Here is a patch that rectifies this situation, albeit in a somewhat 'hacky'
manner.
It works by injecting a monitoring 'tp_free' call into the type during the
basedealloc call, which sets a flag if it was called with the obj
Kristján Valur Jónsson added the comment:
Another, less hacky but more intrusive, way would be to change the signature of
tp_dealloc in a backwards compatible way:
typedef void (*destructor)(PyObject *, int *destroyed);
The destructor can then set the flag pointed to by 'destroyed'
Kristján Valur Jónsson added the comment:
a = map(add, a, b) also crashes this.
a = chain(a, b) also.
If, by "provisions" you speak of sys.max_recursion_depth, that is only invoked
when executing "python" code. What's happening here is just simple c recursion
Kristján Valur Jónsson added the comment:
On the other hand, Antoine is correct in that we _could_ use the existing
infrastructure and count PyIter_Next() as a recursion in the same way as
entering the ceval loop is a recursion. Extra checking in there would hardly
slow down the execution
Kristján Valur Jónsson added the comment:
>at some point it became the Windows API.
You are right: http://en.wikipedia.org/wiki/Windows_API
How about _windowsapi or _winapi then, to ensure there are no clashes?
--
___
Python tracker
&l
Kristján Valur Jónsson added the comment:
> There are other crashers we choose to ignore (involving gc.getreferrers, >
> bytecode hacks, ctypes, etc). I think this should go in that category
> and I would be happy to add a note to that effect in the docs for tertools.
Yes,
Kristján Valur Jónsson added the comment:
Updated the patch with better documentation, and recursion safety.
--
Added file: http://bugs.python.org/file25236/basedealloc.diff
___
Python tracker
<http://bugs.python.org/issue8
Kristján Valur Jónsson added the comment:
Ok, that sounds reasonable, particularly in light of that _NewReference stuff.
I'll work out a different patch then. But I think the API must be public,
since it would need to work from extension modules.
So: if a c type decides that it wan
Kristján Valur Jónsson added the comment:
Incidentally, Looking at this, I noticed code such as: (textio.c)
static int
_textiowrapper_clear(textio *self)
{
if (self->ok && _PyIOBase_finalize((PyObject *) self) < 0)
return -1;
This shows something scary: During a
Kristján Valur Jónsson added the comment:
__del__ methods are never invoked from GC. All objects that have finalizers,
and all objects reachable from them _must_ be put in gc.garbage.
If I'm not mistaken, this is a fundamental rule of python's gc module and it is
not because of t
Kristján Valur Jónsson added the comment:
I've stumbled upon further cases of this problem, and a possible serious bug in
python 3.
the _PyIOBase_finalize() will invoke a "close" method on the object if the
object isn't closed. This is the same as the object having a _
Kristján Valur Jónsson added the comment:
Here is a patch with the suggested change.
I put _PyObject_ResurrectFromDealloc into typeobject.c since it seems more at
home there than in object.c, but I'm not sure.
Also note that other types, that were calling _PyIOBase_finalize() from
Kristján Valur Jónsson added the comment:
I _think_ the only python related things you can do from tp_clear() is
Py_DECREF(), this is what I mean by trivial. This is the reason, for example,
that special care was done with generators.
An IO object could of course do non-python operations
Kristján Valur Jónsson added the comment:
>I don't believe it. I don't see what's magical about being called by the
>gc. Again, a Py_DECREF in tp_dealloc can invoke arbitrary Python code.
Look again. gcmodule specifically takes any objects reachable from ob_clear
and see
Kristján Valur Jónsson added the comment:
Please note that this fix appears to be the cause of #37788
--
nosy: +kristjan.jonsson
___
Python tracker
<https://bugs.python.org/issue36
Kristján Valur Jónsson added the comment:
My favorite topic :)
You could use threading.Barrier() which is designed to synchronize N threads
doing this kind of lock-step processing. The problem is that the Barrier() is
implemented using Condition variables, so for unit-testing, Condition
Kristján Valur Jónsson added the comment:
Thanks for the mention, @pitrou.
CCP was using Py_AddPendingCall but not from signal handlers, but external
threads. Also on windows only.
You'll also be happy to know that I have left CCP and the Eve codebase is being
kept stable while regu
Kristján Valur Jónsson added the comment:
Hi there.
Looking at the API docs today
(https://msdn.microsoft.com/en-us/library/windows/desktop/ms686304(v=vs.85).aspx)
it appears that the timeout case is documented. I'm fairly sure that it wasn't
when I implemented it. There was a good
Kristján Valur Jónsson added the comment:
It is a tricky issue. How deep do you go?what if you are chaining several
of the itertools? Seems like we're entering a semantic sinkhole here.
Deepcopy would be too deep...
The original copy support in these objects stems from the desire to su
Kristján Valur Jónsson added the comment:
OP here, lurking.
The need to load server certificates from memory is quite real. Some seven
years ago I wrote custom code to handle that for CCPs python branch, and
contributed patches to that effect.
It's always dismaying to see how peoples ef
Kristján Valur Jónsson added the comment:
Hi there! By the time pep 442 was introduced, I wasn't very active in python
core stuff anymore, and still am not.
The intent of this patch, which is explained (IMHO) quite clearly in the first
few comments was to
- Formalize a way for c
Kristján Valur Jónsson added the comment:
Interesting, I'll have a look when I'm back from vacation.
On Tue, 4 Sep 2018, 07:04 Raymond Hettinger, wrote:
>
> Raymond Hettinger added the comment:
>
> Also take a look at the other places that have similar logic. I belie
Kristján Valur Jónsson added the comment:
I think I'll pass Raymond, its been so long since I've contributed, in the mean
time there is github and argument clinic and whatnot so I'm out of training.
I´m lurking around these parts and maybe shall
Kristján Valur Jónsson added the comment:
Looks good, I'll give it a spin. This is probably smarter then trying to do
tricks with lists.
One question: I saw you clearing exceptions in the tp_clear() function, isn't
it better to use PyErr_PrintUnraisable()? Is there a guideline
Kristján Valur Jónsson added the comment:
Hi.
the file and line arguments are for expanding from macros such as PyMem_MALLOC.
I had them added because they provide the features of a comprehensive
debugging API.
Of course, I'm not showing you the entire set of modifications that we have
Kristján Valur Jónsson added the comment:
Also, our ccpmem.h, the interface to the ccpmem.cpp, internal flexible memory
allocator framework.
Again, just FYI. There are no trade secrets here, so please ask me for more
details, if interested. One particular trick we have been using, which
Kristján Valur Jónsson added the comment:
sorry, the last example really needs to be:
#module foo.B
A = __import__(".A", fromlist=["dummy"])
to invoke the "return final module" behaviour.
Hm, maybe this simply works... I didn't test
Nope, I get
Va
Kristján Valur Jónsson added the comment:
One question.
when doing "Programmatic" import, i.e. using the __import__ function, how do we
do the same?
#module foo.B
A = __import__(".", fromlist=["A"]).A
#module foo.A
B = __import__(".", fromlist=["
Kristján Valur Jónsson added the comment:
Interesting.
And I can report that it works, in 2.7, with code such as
b = importlib.import_module("..b", __name__)
and
a = importlib.import_module("..a", __name__)
Still, it seems odd that a whole "importlib" is requried o
Kristján Valur Jónsson added the comment:
I'd like to add some argument to providing a "file" and "line number" to the
allocation api. I know that currently this is not provided e.g. by the
PyMem_Allocate() functions, but I think it would be wise to provide a
Kristján Valur Jónsson added the comment:
Hi there.
Thanks for your comments. This is the kind of discussion I was hoping to have
about my draft patch.
I too have reservations about adding arguments. In the version of this that we
have in house, we actually don't use a "certdata
Kristján Valur Jónsson added the comment:
Keeping the GIL requirement is _very_ useful for PyMem_MALLOC et al. It allows
applications to hook in their own monitoring code, accessible from python
itself, without having to worry about conflicts with python.
even if it were not for the GIL
Kristján Valur Jónsson added the comment:
ok, I concede that a file-like object makes sense from a polymorphism point of
view. It makes no sense from a streaming point of view. A caller can then
wrap their data into a StringIO instance.
I'll rework the patch in the manner you su
Kristján Valur Jónsson added the comment:
Antoine, are you suggesting that we remove the current c-level capability to
use file system files (using open()) and just go with raw bytes data at the C
api level, and then do the 'filename or filelike object' in P
Kristján Valur Jónsson added the comment:
Here is an updated patch.
We now support file-like objects.
New helper functions try to turn file arguments into either Py_buffer objects
containing the read data, or PyBytesObject argument with the file system
encoding of the path.
A file-like object
Kristján Valur Jónsson added the comment:
Thanks for your comments Christian.
"You don't check ERR_GET_LIB() in some places."
Do you have a particular place in mind?
About DER. As I understand, currently _ssl only supports PEM. If that is the
case, then supporting DER sho
Kristján Valur Jónsson added the comment:
Ok, thanks.
The consistency argument is strong, also Antoine's suggestion to use the return
type of read() as a discriminant.
also please excuse me because I am not a habitual user of Python 3 and haven't
become used to the str/binary dic
Kristján Valur Jónsson added the comment:
2.7 is the pinnacle of pythonic achievement. Particularly our branch of it :)
One day we'll move, I'm sure, when there is an opportune moment. For example,
if we were to start supporting a new game, a new platform. But for now, if it
ain
Kristján Valur Jónsson added the comment:
Okay, I have updated the patch as suggested.
string mode means PEM encoding, binary mode DER encoding.
Note that DER encoding is more limited, there is no way to concatentate private
keys and certificates into one file (the PEM decoder searches the file
Kristján Valur Jónsson added the comment:
Well done.
--
___
Python tracker
<http://bugs.python.org/issue3329>
___
___
Python-bugs-list mailing list
Unsubscribe:
Kristján Valur Jónsson added the comment:
Is it sufficient to check incr > INT_MAX to guard against overflow?
--
___
Python tracker
<http://bugs.python.org/issu
New submission from Kristján Valur Jónsson:
A proposed patch adds two features to context managers:
1)It has always irked me that it was impossible to assemble nested context
managers in the python language. See issue #5251.
The main problem, that exceptions in __enter__ cannot be properly
Kristján Valur Jónsson added the comment:
IMHO, exitstack is not a very nice construct. It's implementation is far
longer than contextlib.nested.
And the chief problem still remains, which has not been addressed until this
patch (as far as I know):
In Python, it is impossible to co
Kristján Valur Jónsson added the comment:
Simply put, there is no way in the language to nest two context managers, even
though we have full access to their implementation model, i.e. can call
__enter__ and __exit__ manually. This reflects badly (pun intended) on
Python's reflectio
Kristján Valur Jónsson added the comment:
Hi there.
"allowing
suppression of exceptions from __enter__ hides local control flow by
blurring the boundaries between with and if statements.
"
I'm not sure what this means. To me, it is a serious language design flaw that
you can
Kristján Valur Jónsson added the comment:
I've modified the patch. The problem that nested_delayed was trying to solve
are "hybrid" context managers, ones that allocate resources during __init__ and
release them at exit. A proper context manager should allocate resources
d
Kristján Valur Jónsson added the comment:
Thanks, Eric.
I read that bit and I can't say that I disagree.
And I'm not necessarily advocating that "skipping the body" become a standard
feature of context managers. But it is a necessary functionality if you want
to be able
Kristján Valur Jónsson added the comment:
Using my latest patch, the ExitStack inline example can be rewritten:
with ExitStack() as stack:
files = [stack.enter_context(open(fname)) for fname in filenames]
# All opened files will automatically be closed at the end of
Kristján Valur Jónsson added the comment:
"locally visible" is, I think a very misleading term. How is
with ignore_error, acquire_resource as r:
doo_stuff_with_resource(r) #can be silently skipped
any more locally visible than
with acquire_resource_ignore_error as r:
doo_
Kristján Valur Jónsson added the comment:
Here is a new patch.
This uses critical sections and condition variables to avoid kernel mode
switches for locks. Windows mutexes are expensive and for uncontented locks,
this offers a big win.
It also adds an internal set of critical section
Kristján Valur Jónsson added the comment:
return *(PY_LONG_LONG*)&fval == 0;
There is no aliasing, because there are no pointer variables in existence.
If we did this:
double *pfval = &fval;
PY_LONG_LONG *pl = (PY_LONG_LONG*)pfval
return *pfval == 0
Then we would have aliasing.
Kristján Valur Jónsson added the comment:
Interesting.
I declare that this rule does not apply here since the code is a deliberate
hack: We are pretending that a certain address points to integers and checking
those integers.
If you insist on following the standard, you could do
double
Changes by Kristján Valur Jónsson :
--
Removed message: http://bugs.python.org/msg158808
___
Python tracker
<http://bugs.python.org/issue14381>
___
___
Python-bug
Kristján Valur Jónsson added the comment:
Interesting.
I declare that this rule does not apply here since the code is a deliberate
hack: We are pretending that a certain address points to integers and checking
those integers.
If you insist on following the standard, you could do
double
Kristján Valur Jónsson added the comment:
Dang. I yield!
--
___
Python tracker
<http://bugs.python.org/issue14381>
___
___
Python-bugs-list mailing list
Unsub
Kristján Valur Jónsson added the comment:
Two runs with standard locks:
D:\pydev\hg\cpython2>pcbuild\amd64\python.exe -m timeit -s "import _thread; l =
_thread.allocate_lock()" l.acquire();l.release()
100 loops, best of 3: 0.746 usec per loop
D:\pydev\hg\cpython2&
Kristján Valur Jónsson added the comment:
Any thougts? Is a 60% performance increase for the common case of acquiring an
uncontested lock worth doing?
Btw, for our console game I also opted for non-semaphore based locks in
thread_pthread.h, because our console profilers were alarmed at all
Kristján Valur Jónsson added the comment:
The vista specific path is included there for completeness, if and when code
moves to that platform, besides showing what the "emulated CV" is actually
emulating.
Also, I am aware of the old/new GIL, but our console game uses python 2.7 an
Kristján Valur Jónsson added the comment:
Here is a new patch.
I've factored out the NT condittion variable code into thread_nt_cv.h which is
now used by both thread_nt.h and ceval_gil.h
--
Added file: http://bugs.python.org/file25351/ntlocks.
Kristján Valur Jónsson added the comment:
> Except that Microsoft's C library also uses some of the non-WSA
> versions. For instance read() (or _read()) is documented to set
> errno to EBADF or EINVAL on error. So EBADF and EINVAL are just as
> "native" as WSAEBADF
Kristján Valur Jónsson added the comment:
Brian, I posted a suggested port five weeks ago. What kind of problems are you
having? It's really a very straightforward thing.
--
___
Python tracker
<http://bugs.python.org/is
Kristján Valur Jónsson added the comment:
Also, I'm not sure distutils and all that is really necessary. As I understood
it, the goal is to make it so that the casual hacker can compile and run python
using visual studio 2010. 3.3 continues to be "officially" distributed with
Kristján Valur Jónsson added the comment:
> Using your patch, does the following throw an AssertionError?
Yes, it looks as though it will. It seems I was too agressive, since
errnomodule has different entries for EBADF and WSAEBADF.
This is the kind of feedback I'd like to have had
Kristján Valur Jónsson added the comment:
Super, I must have missed that memo. At PyCon there wasn't much enthusiasm for
it, and this was considered a toy project :)
You may be interested in my patch to see what I did with the project files,
then. Otherwise, I'll be happy to re
Kristján Valur Jónsson added the comment:
MVL wrote:
> I'm not convinced that the errno change is actually correct.
You are right, as SBT pointed out. There are cases where we have had
errno.EFOO and errno.WSAEFOO point to different values, because one was used by
sockets and
Kristján Valur Jónsson added the comment:
[the Soney PS3 sdk also has weird error codes for its otherwise posix
compatible api. I did write a translation layer to convert those codes into
posix codes where appropriate. I could show you what I did, but I'd proably
set me up to be lynch
Kristján Valur Jónsson added the comment:
So, what do you think, should this go in? Any qualms about the thread_nt_cv.h
header?
--
___
Python tracker
<http://bugs.python.org/issue11
Kristján Valur Jónsson added the comment:
Antoine: of course, sorry for rushing you.
Martin,
This is an XP patch. The "vista" option is put in there as a compile time
option, and disabled by hand. I'm not adding any apis that weren't already in
use since the new gil
Kristján Valur Jónsson added the comment:
I understand what he meant, but that wasn't the intent of the patch. The patch
is to use simulated critical sections using a semaphore, same as the new GIL
implementation already does.
If you want dynamic runtime detection, then this is a fe
Kristján Valur Jónsson added the comment:
Ok, but the patch as provided would become more compliated. For general
consumption, the primitives would need to become dynamically allocated
structures, and so on. I'm not sure that its worth the effort, but I can have
a look.
(I though
Kristján Valur Jónsson added the comment:
Martin, I think you misunderstand completely. the patch is _not_ about using
the VISTA features. It is about not using a "mutex" for threading.lock.
Currently, the locks in python use Mutex objects, and a WaitForSingleObjects()
syst
Kristján Valur Jónsson added the comment:
Posted some comments.
Also, I see you didn't remove the old SxS functionality, no longer used by
VS2010 (see my sxs.patch)
--
___
Python tracker
<http://bugs.python.org/is
Kristján Valur Jónsson added the comment:
Again, to clarify because this seems to have been put to sleep by Martin's
unfortunate dismissal. A recap of the patch:
1) Extract the Contition Variable functions on windows out of ceval_gil.h and
into thread_nt_cv.h, so that they can be us
Kristján Valur Jónsson added the comment:
Do you think that this optimization is relevant to 2.7?
In that case, it might be worthwhile for me to backport it to our EVE branch...
--
nosy: +kristjan.jonsson
___
Python tracker
<http://bugs.python.
Kristján Valur Jónsson added the comment:
> because I read that realloc() on Windows is not efficient.
Efficiency is not a Boolean property, you know :) Anyway, I´d be surprised if
it were very iniefficient, given that the heap allocators on Windows are quite
mature by
Kristján Valur Jónsson added the comment:
I concur with Martin. It is much easier to tweak .vcproj and .props files and
such after it has been committed, with lesser diffs to worry about.
(A more cautious version of me would have seen this go into a PCBuild10 folder
first for a shakedown
Kristján Valur Jónsson added the comment:
All the old .vcproj files are still there. Probably not useful since the .sln
file has been upgraded to VisualStudio 2010.
--
___
Python tracker
<http://bugs.python.org/issue13
Kristján Valur Jónsson added the comment:
Btw, I have found that socket.closesocket() is quite able, on Windows, to abort
an ongoing accept() call.
--
___
Python tracker
<http://bugs.python.org/issue14
Kristján Valur Jónsson added the comment:
Here is a patch to the .vcproj files and the .props files, based on my earlier
pcbuil10.patch.
Mostly it is about removing redundant settings. It also adds .props files for
the pythoncore solution.
It also updates the readme, the env.bat, and adds
Kristján Valur Jónsson added the comment:
Hi, I'll see what went wrong, I admit not trying 64 bit before creating the
patch.
Martin, I´m using MercurialHQ and exporting a patch. It is set up to use GIT
format diffs, which I think is recommended in the Python developer FAQ. Is
this
Kristján Valur Jónsson added the comment:
That sounds reasonable. So, can't we come up with a diff that does both? The
base revision sounds like a completely necessary piece of info.
--
___
Python tracker
<http://bugs.python.org/is
Kristján Valur Jónsson added the comment:
I wish MS could come up with a property editor that could show you _only_ the
properties that are non-default:
1) view all properties
2) view set and inherited non-defaults
3) view properties set here only.
It would make debugging settings _so_ much
Kristján Valur Jónsson added the comment:
This is fun.
the reason why linking is failing for some projects in x64 mode is:
the SolutionDir (or maybe current dir) is implicitly part of the library search
path. Therefore, when looking for python33_d.lib, it will find the one in
PCbuild, and
401 - 500 of 950 matches
Mail list logo