Enable "dual" Python executables; fixes #34 #42

Merged
merged 1 commit into from Nov 1, 2016

Projects

None yet

4 participants

@eklitzke
Member
eklitzke commented Oct 31, 2016 edited

This change allows Pyflame to be built with support for both Py2 and
Py3, in the same executable. Pyflame can be built to support just one or
the other, or both Python releases.

See https://eklitzke.org/pyflame-dual-interpreter-mode for more information.

@eklitzke eklitzke referenced this pull request Oct 31, 2016
Closed

"idle" detalization #41

src/pyflame.cc
#include "./version.h"
+// FIXME: this logic should be moved to configure.ac
+#if !defined(ENABLE_PY2) && !defined(ENABLE_PY2)
src/frob.cc
+namespace pyflame {
+
+#if PYFLAME_PY_VERSION == 2
+#define PREFIX Py2
@Torwegia
Torwegia Oct 31, 2016

This doesn't seem used?

@jeevandev

Rest LGTM apart from 2 comments

src/symbol.cc
+ break;
+ }
+ }
+ if (version != nullptr) {
@jeevandev
jeevandev Nov 1, 2016 Contributor

Why is this check done at the end? Isn't version cannot be a nullptr & the check needs to happen at the beginning & assert()?

@eklitzke
eklitzke Nov 1, 2016 Member

I actually removed this check in the most recent version, since the function is only called in one place w/o a null pointer.

src/pyfrob.cc
#include "./symbol.h"
+#define FROB_FUNCS \
+ unsigned long ThreadStateAddr(pid_t pid, Namespace *ns); \
@jeevandev
jeevandev Nov 1, 2016 Contributor

Where is ThreadStateAddr(pid_t pid, Namespace *ns) used? I see only with the version param being used.

@eklitzke
eklitzke Nov 1, 2016 Member

Good catch, removing this!

@eklitzke eklitzke Enable "dual" Python executables; fixes #34
This change allows Pyflame to be built with support for both Py2 and
Py3, in the same executable. Pyflame can be built to support just one or
the other, or both Python releases.

More details here: https://eklitzke.org/pyflame-dual-interpreter-mode
f21969d
@eklitzke eklitzke merged commit 2911c7e into master Nov 1, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@eklitzke eklitzke deleted the deephack branch Nov 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment