This repository has been archived by the owner on Sep 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Python] Found and solved a threading issue. Revisisted the API to ha…
…ve this fixed. Documentation stil to update.
- Loading branch information
Showing
14 changed files
with
694 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,39 @@ | ||
## v0.3 - XXXX-XX-XX | ||
|
||
### New features | ||
|
||
* Python: added unit tests and improved the documentation. | ||
* Python: added functions beginCriticalSection() / endCriticalSection() | ||
|
||
### Fixes | ||
|
||
* Python: fixed multithreading issue | ||
|
||
### Compatibility breakers | ||
|
||
*none* | ||
|
||
|
||
## v0.2 - 2020-05-15 | ||
|
||
### New features | ||
|
||
* Added `CRC` class and `hash` module. | ||
|
||
### Fixes | ||
|
||
*none* | ||
|
||
### Compatibility breakers | ||
|
||
* Moved `include/<modules>` directories to `include/shlublu/<modules>`. Includes directives `#include<module/function.h>` should be replaced by `#include<shlublu/module/function.h>` in your code. | ||
* Put all exposed symbols behind global namespace `shlublu::`. You can either prefix symbols accordingly or use `using namespace shlublu;`. | ||
* In `util/Debug.h`: changed macros names from `PRAGMA_xxx` to `SHLUBLU_xxx` as namespaces do not apply to macros. They should be renamed in your code too. | ||
|
||
|
||
## v0.1 - 2020-05-13 | ||
|
||
First workable version. | ||
|
||
|
||
## v0.3 - XXXX-XX-XX | ||
|
||
### New features | ||
|
||
* Python: | ||
* introduced `ObjectHandler`, compatible with CPython's `PyObject *` | ||
* added functions `beginCriticalSection()` / `endCriticalSection()` | ||
* added unit tests and improved the documentation. | ||
|
||
### Fixes | ||
|
||
* Python: fixed a multithreading issue | ||
|
||
### Compatibility breakers | ||
|
||
* Python: `ValueRef` and `ArgsRef` have been replaced by `ObjectHandler`. Explicit use of htese types should be replaced in your code. | ||
|
||
## v0.2 - 2020-05-15 | ||
|
||
### New features | ||
|
||
* Added `CRC` class and `hash` module. | ||
|
||
### Fixes | ||
|
||
*none* | ||
|
||
### Compatibility breakers | ||
|
||
* Moved `include/<modules>` directories to `include/shlublu/<modules>`. Includes directives `#include<module/function.h>` should be replaced by `#include<shlublu/module/function.h>` in your code. | ||
* Put all exposed symbols behind global namespace `shlublu::`. You can either prefix symbols accordingly or use `using namespace shlublu;`. | ||
* In `util/Debug.h`: changed macros names from `PRAGMA_xxx` to `SHLUBLU_xxx` as namespaces do not apply to macros. They should be renamed in your code too. | ||
|
||
|
||
## v0.1 - 2020-05-13 | ||
|
||
First workable version. | ||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#pragma once | ||
|
||
#include <shlublu/util/Exceptions.h> | ||
|
||
|
||
namespace shlublu | ||
{ | ||
|
||
namespace Python | ||
{ | ||
|
||
/** | ||
Python throws this exception should an issue happen. | ||
*/ | ||
class BindingException : public ShlubluException | ||
{ | ||
public: | ||
/** | ||
Constructor. | ||
@param message description of the issue | ||
*/ | ||
explicit BindingException(const std::string& message) | ||
: ShlubluException(("Python binding: " + message).c_str()) | ||
{} | ||
|
||
/** | ||
Constructor. | ||
@param message description of the issue | ||
*/ | ||
explicit BindingException(const char* message) | ||
: BindingException(std::string(message)) | ||
{} | ||
}; | ||
|
||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#pragma once | ||
|
||
#define PY_SSIZE_T_CLEAN | ||
#include <Python.h> | ||
|
||
|
||
namespace shlublu | ||
{ | ||
|
||
namespace Python | ||
{ | ||
|
||
class ObjectHandler | ||
{ | ||
public: | ||
class Hasher | ||
{ | ||
public: | ||
int64_t operator()(ObjectHandler const& key) const; | ||
}; | ||
|
||
|
||
public: | ||
ObjectHandler(); | ||
ObjectHandler(ObjectHandler const& src); | ||
ObjectHandler(ObjectHandler&& src) noexcept; | ||
ObjectHandler(PyObject* pyObj); | ||
|
||
ObjectHandler& operator = (ObjectHandler src) noexcept; | ||
|
||
void swap(ObjectHandler& other) noexcept; | ||
|
||
PyObject* get() const; | ||
uint64_t id() const; | ||
|
||
operator PyObject* () const; | ||
|
||
private: | ||
PyObject* mPyObj; | ||
uint64_t mId; | ||
|
||
private: | ||
uint64_t nextId(); | ||
|
||
static uint64_t sSequence; | ||
}; | ||
|
||
|
||
bool operator == (ObjectHandler const& lhs, ObjectHandler const& rhs); | ||
bool operator != (ObjectHandler const& lhs, ObjectHandler const& rhs); | ||
|
||
} | ||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.