[Python-Dev] FW: [Python-Help] Python threads with suncc (Forte 6.1) compiler

Tim Peters tim.one@home.com
Sun, 5 Aug 2001 18:50:06 -0400


[Michael Hudson]
> ...
> (1) Doesn't the Python fileno() method issue leave you open to
> ridiculous fileno() methods that mutate the list passed in to
> select()?

Yes, but that's par for the course, and selectmodule is suitably paranoid
about it (unfortunately, this is *so* common in the implementation that it's
rarely mentioned in comments -- so there's a real danger of "simplifying"
seemingly overly-elaborate code into creating a hole).  list2set() is
unusual in letting PyList_GetItem catch it, though:

	int len = PyList_Size(list);
	...
	for (i = 0; i < len; i++)  {
		SOCKET v;

		/* any intervening fileno() calls could decr this refcnt */
		if (!(o = PyList_GetItem(list, i)))
                    return -1;
		Py_INCREF(o);

It's more common to see

	for (i = 0; i < PyList_Size(list); i++)  {

i.e. to recompute the list length on each trip, and so silently ignore
length-changing mutations.

> (2) AIUI,

New one on me!

at-least-as-i-understand-it<wink>-ly y'rs  - tim