[Checkins] [zopefoundation/Acquisition] f9585d: Clean up the __of__method a bit.
GitHub
noreply at github.com
Wed Feb 22 08:07:58 CET 2017
Branch: refs/heads/c-extension-clean
Home: https://github.com/zopefoundation/Acquisition
Commit: f9585d05f2021b83c7be3aea97ece0288a8bf309
https://github.com/zopefoundation/Acquisition/commit/f9585d05f2021b83c7be3aea97ece0288a8bf309
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Clean up the __of__method a bit.
Commit: 74bd666f9c7653c10154b47be23adaa34a4876c8
https://github.com/zopefoundation/Acquisition/commit/74bd666f9c7653c10154b47be23adaa34a4876c8
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Get rid of temporary variable.
Commit: d5fc5f230d8788b5d7ac4a5daa9e5dc2d4373850
https://github.com/zopefoundation/Acquisition/commit/d5fc5f230d8788b5d7ac4a5daa9e5dc2d4373850
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Use the proper macros in visit and traverse.
Commit: 614d1d605eb3d62e9fb210aa1630a5457adb3bd7
https://github.com/zopefoundation/Acquisition/commit/614d1d605eb3d62e9fb210aa1630a5457adb3bd7
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Improve apply_filter.
- No goto
- Handle errors returned by PyObject_IsTrue.
- Use PyObject_CallFunctionObjArgs, which is a more robust way to call functions.
- Ident with 4 spaces.
Commit: 37ae33a05bafdce44ed2bf7d6d875cc7d841af67
https://github.com/zopefoundation/Acquisition/commit/37ae33a05bafdce44ed2bf7d6d875cc7d841af67
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Improve some Wrapper methods by
- Replace tabs with spaces.
- Braces on the same line as if.
- ident with 4 spaces.
- Use OBJECT for typecast.
Commit: f6530c96d4401557286ece3d9d24ef2af08df118
https://github.com/zopefoundation/Acquisition/commit/f6530c96d4401557286ece3d9d24ef2af08df118
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Refactor CallMethodO.
Did not like they way it handles the ref-count of args.
All the other C-API calls do *not* decref the reference count of args.
So this method behaves not as you usually expect.
Add a new method 'CallMethodArgs' which makes it easier to call methods
where format strings are used to specify positional arguments.
Commit: d8908d7b3a4edd15a544a253acf8c2398ff8f05e
https://github.com/zopefoundation/Acquisition/commit/d8908d7b3a4edd15a544a253acf8c2398ff8f05e
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Let the number protocol wrappers use the new CallMethodArgs method.
This is results in a 20% speedup, since PyObject_CallMethod creates
*always* a new string (unicode in py3) object from the 'char *' pointer.
Commit: 1d0e55c869508efbd54dd8ae49408f8613cfaf06
https://github.com/zopefoundation/Acquisition/commit/1d0e55c869508efbd54dd8ae49408f8613cfaf06
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Implement the tp_new slot.
With this change it is impossible to create a Wrapper object where
'self->obj' == NULL. __new__ is the very first place where a new
instance is created and there it is ensured that self->obj is set to a
reasonable value. I have seen no other code where self->obj is set.
This allows now to change several places in _Acquisition.c where
self->obj is checked for NULL pointer. Which leads to simpler code.
Commit: eda50b3b410765704686ff0cb1188be543ec0d59
https://github.com/zopefoundation/Acquisition/commit/eda50b3b410765704686ff0cb1188be543ec0d59
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Refactor Wrapper_special
* Make use of the fact that 'self->obj' cannot be NULL (if its of type Wrapper)
* Replace tabs with spaces
* Use 4 spaces to ident
Commit: 17700326975107f812a4b78531c7a8e0ec04a9c9
https://github.com/zopefoundation/Acquisition/commit/17700326975107f812a4b78531c7a8e0ec04a9c9
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Clean up: Wrapper_findattr_name
- Ident with 4 spaces
- replace tabs with spaces
- More use of braces. I know in some situations they can be omited,
but they are very dangerous and typically avoided.
- Introduce two macros to check
- if a string starts with another string
- if a string is equal to another
- move the swallowing of attribute error into function for reuse.
The string macros and swallow_attribute_error have to potential to be
user for more cleanups.
Commit: 1033f59cb62ad86e81015ee36796da0562d86328
https://github.com/zopefoundation/Acquisition/commit/1033f59cb62ad86e81015ee36796da0562d86328
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Refactor Wrapper_acquire.
Commit: 7e3fe5bb9d5d8b642eed4d42379e2884d9a2f511
https://github.com/zopefoundation/Acquisition/commit/7e3fe5bb9d5d8b642eed4d42379e2884d9a2f511
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Refactor Wrapper_getattro
Due to __new__ there is always self->obj.
Commit: d5596e37292b76c45fa6ee998dba976b80219b57
https://github.com/zopefoundation/Acquisition/commit/d5596e37292b76c45fa6ee998dba976b80219b57
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Refactor Wrapper_[get,set]attro
* Make use of the fact that no empty wrappers exist any more.
* This hand craftet startswith has no meassurable speed boost => omitted.
* The usual spaces/tabs/indent stuff.
Commit: 023966b57c485282fe38a7600b745056a6161de8
https://github.com/zopefoundation/Acquisition/commit/023966b57c485282fe38a7600b745056a6161de8
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Refactor Wrapper_[rich]compare
Commit: f58bc5d5162aaebe97e3a8ac2cde0cefc2309120
https://github.com/zopefoundation/Acquisition/commit/f58bc5d5162aaebe97e3a8ac2cde0cefc2309120
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Refactor Wrapper_[repr,str,unicode]
Just the right identation.
Commit: a5066eb659d20f379de8a5d3d3fafb4a2469187c
https://github.com/zopefoundation/Acquisition/commit/a5066eb659d20f379de8a5d3d3fafb4a2469187c
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Refactor: Wrapper_coerce
Commit: 393f922db506eea45eea41ca2de5dfad1762d0f8
https://github.com/zopefoundation/Acquisition/commit/393f922db506eea45eea41ca2de5dfad1762d0f8
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Refactor Wrapper_acquire_method
Typical tab/spaces/ident stuff.
Commit: ae2e2a1caf4300933c195fb9d90925cfaec8070f
https://github.com/zopefoundation/Acquisition/commit/ae2e2a1caf4300933c195fb9d90925cfaec8070f
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
White space tab cleanup.
Commit: 577ea2b3ae19bc38f0ff33eb89d999b7404eed83
https://github.com/zopefoundation/Acquisition/commit/577ea2b3ae19bc38f0ff33eb89d999b7404eed83
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Refactor acquire_of.
Instead of two functiond doing nearly the same, create a now one with
the Wrapper class to create as a parameter.
Since only a single argument is needed use METH_O instead of VARARGS.
Now the argument parsing inside the function can be omited, because
python does this for us.
Commit: 6e11721921797d69df1b9c7046d65ce3a9adb61f
https://github.com/zopefoundation/Acquisition/commit/6e11721921797d69df1b9c7046d65ce3a9adb61f
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Refactor [module|capi]_aq_acquire
Commit: 4f427f6e1a0db627187e935066972ef4c419ab8d
https://github.com/zopefoundation/Acquisition/commit/4f427f6e1a0db627187e935066972ef4c419ab8d
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Refactor capi_aq_get.
Almost the same as 'aq_acquire'.
Only difference is that the default value is always returned if *any*
excpetion happens.
aq_acquire returns the default value just on Attribute error.
The important bit is to call aq_aquire with
filter=NULL
extra=NULL
explicit=1
Commit: e9f08ed9b0854852c86b35db1a5f2e08b5f1b40c
https://github.com/zopefoundation/Acquisition/commit/e9f08ed9b0854852c86b35db1a5f2e08b5f1b40c
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Refactor [capi|module]_aq_base
* __new__ ensures that self->obj is never NULL
* Use METH_O instead of manual parsing a single argument.
Commit: 6ccd582c42674946fea351c373340949c3c028c6
https://github.com/zopefoundation/Acquisition/commit/6ccd582c42674946fea351c373340949c3c028c6
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Refactor [capi|module]_aq_parent
* The usual tabs/spaces/ident stuff.
* Use METH_O for a function with a single argument.
Commit: a5d25ac1f9571cca178e9bc457403c0d0e6bca5e
https://github.com/zopefoundation/Acquisition/commit/a5d25ac1f9571cca178e9bc457403c0d0e6bca5e
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Refactor [module|capi]_aq_self
Commit: c24b76b4a9195a87c31dc1682f0312174648fc4e
https://github.com/zopefoundation/Acquisition/commit/c24b76b4a9195a87c31dc1682f0312174648fc4e
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Refactor [module|capi]_ac_inner
* The usual tabs/spaces/ident stuff.
* Make use of the fact that __new__ ensures that self->obj is never NULL
Commit: 718190a3c0fdc03bafe712de6b10d6facdb11b1d
https://github.com/zopefoundation/Acquisition/commit/718190a3c0fdc03bafe712de6b10d6facdb11b1d
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Refactor [module|capi]_aq_chain
* Usual tabs/spaces/ident stuff
* Make use of the fact that __new__ ensures that self->obj is never NULL
* Fix memory leak when PyObject_GetAttr(self, py__parent__) raised
something else then AttributeError. Before 'result' was leaking.
* The 'err:' section returned 'result' in case of erros. Due to the decref
before 'result' became an invalid pointer. Returning this pointer
would have let to a segfault. The proper way to signal an error is by
returning a NULL pointer. As it is done now.
* Prevent segfault if the return value of
PyObject_GetAttr(self, py__parent__) had an refcount of 1.
In that case it Py_DECREF came too early and an access of this pointer
later would have lead to segfault. Now the reference is kept alive
until the end of the function. Yes this complicated the other
assignments to self a bit.
Commit: 8fb4a9d603b848e54932569cfc6c79988d1af772
https://github.com/zopefoundation/Acquisition/commit/8fb4a9d603b848e54932569cfc6c79988d1af772
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Refactor [module|capi]_aq_inContextOf
* The usual tab/spaces/ident stuff.
* No checks for self->obj are needed, because __new__ ensures that its always set.
* Handle errors from capi_aq_inner and capi_aq_parent.
Before the NULL pointer was used as a regular result,
which would have lead to segfault.
* Don't decref the result from capi_aq_parent too early.
Before the result of capi_aq_parent() was immediatly Py_DECREF and
after that *used* ! This was a potential segfault in case the result
of this had a refcount of 1.
Now the refcount is decremented at the very end.
Commit: fc62c8f15dbbb4919d9cf47285c7371cc78b2379
https://github.com/zopefoundation/Acquisition/commit/fc62c8f15dbbb4919d9cf47285c7371cc78b2379
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Ident with 4 instead of 2 spaces.
Commit: e39d84209651e532a3d1c9d1fdd74b744c539589
https://github.com/zopefoundation/Acquisition/commit/e39d84209651e532a3d1c9d1fdd74b744c539589
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Get rid of a few typedefs and defines.
Modern verions of python have them in their headers.
Commit: 90f0b876e87625b47410d159e3e3e40eea44c611
https://github.com/zopefoundation/Acquisition/commit/90f0b876e87625b47410d159e3e3e40eea44c611
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Python has an implementation for ASSIGN, lets use it.
Commit: 4bc69ddc331cdfe69542b790db319b14d4b051f2
https://github.com/zopefoundation/Acquisition/commit/4bc69ddc331cdfe69542b790db319b14d4b051f2
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Use get_base at other places.
New helper function get_inner.
Commit: 3fbe9e73c17d1f4e21ca671a1a7c5e311d1a3a9e
https://github.com/zopefoundation/Acquisition/commit/3fbe9e73c17d1f4e21ca671a1a7c5e311d1a3a9e
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Use apply__of__ at other places.
Commit: 7df3c811cf435cc10f10dc4d29340748f244dced
https://github.com/zopefoundation/Acquisition/commit/7df3c811cf435cc10f10dc4d29340748f244dced
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M src/Acquisition/_Acquisition.c
Log Message:
-----------
Use STR_EQ in Wrapper_special.
Commit: af4f0b3c6c5b7f7591b40fd514c265fd40614021
https://github.com/zopefoundation/Acquisition/commit/af4f0b3c6c5b7f7591b40fd514c265fd40614021
Author: stephan-hof <sh at axiros.com>
Date: 2017-02-22 (Wed, 22 Feb 2017)
Changed paths:
M include/ExtensionClass/ExtensionClass.h
Log Message:
-----------
Add the latest ExtensionClass.h
Compare: https://github.com/zopefoundation/Acquisition/compare/f9585d05f202^...af4f0b3c6c5b
More information about the checkins
mailing list