diff options
author | Nadeem Vawda <nadeem.vawda@gmail.com> | 2013-10-28 21:41:24 +0100 |
---|---|---|
committer | Nadeem Vawda <nadeem.vawda@gmail.com> | 2013-10-28 21:41:24 +0100 |
commit | acf010d6b83e6ee4bc916a61b04938f2f4205810 (patch) | |
tree | 20104eff0d9561d62fc9f538a7882d7b98e00ac1 /Python/thread_pthread.h | |
parent | 284a788ebc97e88858f9299669470438dcf0ebfb (diff) | |
parent | c3408df66ec4dbebcbbfc283cebd9736d97f5f1c (diff) | |
download | cpython-acf010d6b83e6ee4bc916a61b04938f2f4205810.tar.gz |
#19395: Raise exception when pickling a (BZ2|LZMA)(Compressor|Decompressor).
The underlying C libraries provide no mechanism for serializing compressor and
decompressor objects, so actually pickling these classes is impractical.
Previously, these objects would be pickled without error, but attempting to use
a deserialized instance would segfault the interpreter.
Diffstat (limited to 'Python/thread_pthread.h')
-rw-r--r-- | Python/thread_pthread.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h index e90ae7e5b9..20f8535896 100644 --- a/Python/thread_pthread.h +++ b/Python/thread_pthread.h @@ -282,14 +282,14 @@ PyThread_allocate_lock(void) if (!initialized) PyThread_init_thread(); - lock = (sem_t *)malloc(sizeof(sem_t)); + lock = (sem_t *)PyMem_RawMalloc(sizeof(sem_t)); if (lock) { status = sem_init(lock,0,1); CHECK_STATUS("sem_init"); if (error) { - free((void *)lock); + PyMem_RawFree((void *)lock); lock = NULL; } } @@ -313,7 +313,7 @@ PyThread_free_lock(PyThread_type_lock lock) status = sem_destroy(thelock); CHECK_STATUS("sem_destroy"); - free((void *)thelock); + PyMem_RawFree((void *)thelock); } /* @@ -410,7 +410,7 @@ PyThread_allocate_lock(void) if (!initialized) PyThread_init_thread(); - lock = (pthread_lock *) malloc(sizeof(pthread_lock)); + lock = (pthread_lock *) PyMem_RawMalloc(sizeof(pthread_lock)); if (lock) { memset((void *)lock, '\0', sizeof(pthread_lock)); lock->locked = 0; @@ -430,7 +430,7 @@ PyThread_allocate_lock(void) CHECK_STATUS("pthread_cond_init"); if (error) { - free((void *)lock); + PyMem_RawFree((void *)lock); lock = 0; } } @@ -457,7 +457,7 @@ PyThread_free_lock(PyThread_type_lock lock) status = pthread_mutex_destroy( &thelock->mut ); CHECK_STATUS("pthread_mutex_destroy"); - free((void *)thelock); + PyMem_RawFree((void *)thelock); } PyLockStatus |