Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(python): reference isomorphism is broken within __init__ #1724

Merged
merged 5 commits into from
Jun 9, 2020

Conversation

RomainMuller
Copy link
Contributor

Within the __init__ of a class, reading self back from the JS
process would result in a proxy object created for the parent type,
instead of returning self. This is because the JSIIMeta metaclass
only registered the instance in the rerefence map after the
constructor had returned.

This adds an additional registration point right after the create API
returned from the kernel, making the reference available as early as it
can possibly be known.

Fixes aws/aws-cdk#8262


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Within the `__init__` of a class, reading `self` back from the JS
process would result in a proxy object created for the parent type,
instead of returning `self`. This is because the `JSIIMeta` metaclass
only registered the instance in the rerefence map **after** the
constructor had returned.

This adds an additional registration point right after the `create` API
returned from the kernel, making the reference available as early as it
can possibly be known.

Fixes aws/aws-cdk#8262
@RomainMuller RomainMuller added bug This issue is a bug. language/python Related to Python bindings module/runtime Issues affecting the `jsii-runtime` labels Jun 9, 2020
@RomainMuller RomainMuller requested a review from a team June 9, 2020 09:02
@RomainMuller RomainMuller self-assigned this Jun 9, 2020
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jun 9, 2020
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-Blkkw9bQFn8A
  • Commit ID: df12ec8
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-Blkkw9bQFn8A
  • Commit ID: 57aa793
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-Blkkw9bQFn8A
  • Commit ID: a8c292f
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Jun 9, 2020

Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it!

@mergify mergify bot added the pr/ready-to-merge This PR is ready to be merged. label Jun 9, 2020
@mergify
Copy link
Contributor

mergify bot commented Jun 9, 2020

Merging (with squash)...

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-Blkkw9bQFn8A
  • Commit ID: 1d13dba
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-Blkkw9bQFn8A
  • Commit ID: db81b86
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit b7be1c6 into master Jun 9, 2020
@mergify mergify bot deleted the rmuller/fix-python-early-registration branch June 9, 2020 11:43
@mergify
Copy link
Contributor

mergify bot commented Jun 9, 2020

Merging (with squash)...

@mergify mergify bot removed the pr/ready-to-merge This PR is ready to be merged. label Jun 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. contribution/core This is a PR that came from AWS. language/python Related to Python bindings module/runtime Issues affecting the `jsii-runtime`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws_cdk.core.Stack.of() returns wrong class type (in Python)
3 participants