@@ -12,6 +12,7 @@ class FFI
1212 attach_function :add_serialized_file , :upb_DefPool_AddFile , [ :DefPool , :FileDescriptorProto , Status . by_ref ] , :FileDef
1313 attach_function :free_descriptor_pool , :upb_DefPool_Free , [ :DefPool ] , :void
1414 attach_function :create_descriptor_pool , :upb_DefPool_New , [ ] , :DefPool
15+ attach_function :disable_closed_enum_checking , :upb_DefPool_DisableClosedEnumChecking , [ :DefPool ] , :void
1516 attach_function :get_extension_registry , :upb_DefPool_ExtensionRegistry , [ :DefPool ] , :ExtensionRegistry
1617 attach_function :lookup_enum , :upb_DefPool_FindEnumByName , [ :DefPool , :string ] , EnumDescriptor
1718 attach_function :lookup_extension , :upb_DefPool_FindExtensionByName , [ :DefPool , :string ] , FieldDescriptor
@@ -30,6 +31,9 @@ def initialize
3031 @descriptor_pool = ::FFI ::AutoPointer . new ( Google ::Protobuf ::FFI . create_descriptor_pool , Google ::Protobuf ::FFI . method ( :free_descriptor_pool ) )
3132 @descriptor_class_by_def = { }
3233
34+ # Ruby treats all enums as open.
35+ Google ::Protobuf ::FFI . disable_closed_enum_checking ( @descriptor_pool )
36+
3337 # Should always be the last expression of the initializer to avoid
3438 # leaking references to this object before construction is complete.
3539 Google ::Protobuf ::OBJECT_CACHE . try_add @descriptor_pool . address , self
0 commit comments