Skip to content

Fix/tcolor preserve metadata#20046

Closed
aviralgarg05 wants to merge 2 commits into
root-project:masterfrom
aviralgarg05:fix/tcolor-preserve-metadata
Closed

Fix/tcolor preserve metadata#20046
aviralgarg05 wants to merge 2 commits into
root-project:masterfrom
aviralgarg05:fix/tcolor-preserve-metadata

Conversation

@aviralgarg05

Copy link
Copy Markdown

This Pull request:

Changes or fixes:

  • Add import functools to enable metadata preservation
  • Decorate wrapper function with @functools.wraps(original_init) to maintain name, doc, and wrapped attributes
  • Fixes TColor.DefinedColors(1) failure in Jupyter notebooks
  • Ensures proper method resolution in introspection-heavy environments

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

This PR fixes #20018

@github-actions

github-actions Bot commented Oct 7, 2025

Copy link
Copy Markdown

Test Results

    22 files      22 suites   3d 22h 39m 47s ⏱️
 3 781 tests  3 776 ✅ 0 💤  5 ❌
81 252 runs  81 227 ✅ 0 💤 25 ❌

For more details on these failures, see this check.

Results for commit 104c3c9.

♻️ This comment has been updated with latest results.

@dpiparo dpiparo assigned linev and guitargeek and unassigned linev Oct 8, 2025
@dpiparo dpiparo requested a review from guitargeek October 8, 2025 05:00
@dpiparo

dpiparo commented Oct 8, 2025

Copy link
Copy Markdown
Member

Thanks for this code. In order to start the review we would need to also have a test that reproduces the problem. Notebook tests are in this directory https://github.com/root-project/root/tree/master/roottest/python/JupyROOT

@aviralgarg05 aviralgarg05 requested a review from bellenot as a code owner October 8, 2025 08:01
@aviralgarg05 aviralgarg05 force-pushed the fix/tcolor-preserve-metadata branch from a4fcac7 to 126b87a Compare October 9, 2025 15:42
Comment thread roottest/python/JupyROOT/verify_fix.py Outdated
@aviralgarg05

Copy link
Copy Markdown
Author

I'll go through them and solve

@aviralgarg05 aviralgarg05 force-pushed the fix/tcolor-preserve-metadata branch from 30c8fe7 to 104c3c9 Compare November 29, 2025 21:41
@aviralgarg05 aviralgarg05 force-pushed the fix/tcolor-preserve-metadata branch from 104c3c9 to 8d65248 Compare December 19, 2025 18:15
This fixes the Jupyter TColor.DefinedColors behavior.

Closes root-project#20018.
Add notebook test and unit test to verify that TColor.__init__ metadata
is preserved after pythonization. This ensures that introspection-heavy
environments like Jupyter can properly inspect the method.

  * Add tcolor_definedcolors.ipynb: reproduces original issue root-project#20018
  * Add test_tcolor_metadata.py: unit tests for metadata preservation
  * Update CMakeLists.txt: register notebook test in test suite

This is a regression test for root-project#20018.
@guitargeek guitargeek force-pushed the fix/tcolor-preserve-metadata branch from 8d65248 to 6796c40 Compare June 14, 2026 08:51
@guitargeek

guitargeek commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

This was not the real fix. The actual fix is:

@guitargeek guitargeek closed this Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ROOT.TColor.DefinedColors(1) problematic in jupyter notebooks

6 participants