[
https://issues.apache.org/jira/browse/THRIFT-3783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15230887#comment-15230887
]
ASF GitHub Bot commented on THRIFT-3783:
----------------------------------------
Github user Jens-G commented on a diff in the pull request:
https://github.com/apache/thrift/pull/982#discussion_r58929507
--- Diff: test/py/object_gen_order/cycle.thrift ---
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+namespace py cycle
+
+struct A {
+ 1: B b;
+}
+
+struct B {
+ 1: A a;
+}
--- End diff --
As I said, that's legal code.
> python code generator dose not handle struct dependent
> ------------------------------------------------------
>
> Key: THRIFT-3783
> URL: https://issues.apache.org/jira/browse/THRIFT-3783
> Project: Thrift
> Issue Type: Bug
> Components: Python - Compiler
> Reporter: Huabin
> Priority: Minor
>
> given thrift idl
> {code}
> struct A {
> 1: B b,
> }
> struct B {
> 1: i32 b,
> }
> {code}
> generated ttypes.py
> {code}
> 20 class A:
> 21 """
> 22 Attributes:
> 23 - b
> 24 """
> 25
> 26 thrift_spec = (
> 27 None, # 0
> 28 (1, TType.STRUCT, 'b', (B, B.thrift_spec), None, ), # 1
> 29 )
> 30
> {code}
> import A will cause error since it referenced B, which has not be defined.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)