Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1088243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:02:50+00:00 2026-05-16T23:02:50+00:00

This may be a bit of a weird question, but is there any reliable

  • 0

This may be a bit of a weird question, but is there any reliable way to serialize IronPython objects whose classes extend CLR types?

For instance:

class Foo(System.Collections.Generic.List[str]):
    def Test(self):
        print "test!"

System.Collections.Generic.List<string> is serializable with Pickle, as it implements the ISerializable interface, but emitted subclasses of serializable CLR types seem to not work, and i get ImportError: No module named Generic in mscorlib, Version=4 when running pickle.dumps(Foo()).

Additionally, running the usual Formatter.Serialize(stream, object) gives me:

SystemError: Type 'IronPython.NewTypes.System.Collections.Generic.List`1_4$4' in Assembly Snippets.scripting, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.

How can I implement serialization of IronPython objects when running in an embedded C# environment?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:02:50+00:00Added an answer on May 16, 2026 at 11:02 pm

    Quote from clrtype metaclasses

    IronPython doesn’t support Reflection
    based APIs or custom attributes today
    because IronPython doesn’t emit a
    custom CLR types for every Python
    class. Instead, it typically shares a
    single CLR type across many Python
    classes. For example, all three of
    these Python classes share a single
    underlying CLR type.

    class shop(object):
      pass 
    
    class cheese_shop(shop):
      def have_cheese(self, cheese_type):
        return False
    
    class argument_clinic(object):
      def is_right_room(self, room=12):
        return "I've told you once"
    
    import clr
    print clr.GetClrType(shop).FullName
    print clr.GetClrType(cheese_shop).FullName
    print clr.GetClrType(argument_clinic).FullName 
    

    Even though cheese_shop inherits from
    shop and argument_clinic inherits from
    object, all three classes share the
    same underlying CLR type

    I haven’t tried, but maybe you can solve this issue with manual serialization via serialization surrogates.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This may be a bit of daft question, but I don't come from an
Ok, so this may be a bit of a silly question, and there's certainly
This may sound like a bit of a rhetorical question, but I ask it
This question may seem a little bit stackoverflow-implementation specific, but I have seen a
OK, this may sound weird, but here goes. There are 2 computers, A (Pentium
Okay this may sound a bit weird but it is what I have to
This may be a bit of an easy, headdesk sort of question, but my
This may be a silly question but should I use the 32 bit or
This may be a easy question to answer but I am a bit stumped
This may sound like a weird question but I will give it a shot

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.